1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 package net.sf.jameleon.plugin.watij.tags;
21
22 import net.sf.jameleon.plugin.watij.WatijFunctionTag;
23
24 import watij.runtime.ie.IE;
25
26 /***
27 * Brings the window defined by childBrowserIndex to the front and makes it active. This tag will
28 * wait up to a minute for the new window to display before failing.
29 *
30 * For example, to bring the 2nd window to the front:
31 *
32 * <pre><source>
33 * <testcase xmlns="jelly:jameleon" xmlns:j="jelly:core">
34 * <watij-session baseUrl="http://some.url/some/path" beginSession="true">
35 * <watij-bring-to-front
36 * functionId="Bring 2nd window up to the front"
37 * childBrowserIndex="1"/>
38 * </watij-session>
39 * </testcase>
40 * </source></pre>
41 *
42 * @jameleon.function name="watij-bring-to-front" type="action"
43 */
44 public class WatijBringToFrontTag extends WatijFunctionTag{
45
46 /***
47 * The index number of the child browser to activate where the 1st child is <code>0</code>.
48 * @jameleon.attribute
49 */
50 protected Integer childBrowserIndex;
51 /***
52 * Bring the original browser back into focus.
53 * @jameleon.attribute default="false"
54 */
55 protected boolean parentBrowser;
56
57 public void testBlock() throws Exception{
58 if (parentBrowser) {
59 setCurrentIE(getParentBrowser());
60 }else if (childBrowserIndex != null){
61 IE childBrowser = ie().childBrowser(childBrowserIndex.intValue());
62 childBrowser.bringToFront();
63 childBrowser.focus();
64 setCurrentIE(childBrowser);
65 }
66 }
67
68 }