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 watij.elements.HtmlElement;
23 import watij.finders.Symbol;
24
25 /***
26 * Gets a checkbox on the page and stores in the context.
27 *
28 * An example might be to get a checkbox button via its name:
29 *
30 * <pre><source>
31 * <testcase xmlns="jelly:jameleon" xmlns:j="jelly:core">
32 * <watij-session baseUrl="http://some.url/some/path" beginSession="true">
33 * <watij-checkbox
34 * functionId="Gets a checkbox vi its name"
35 * how="name"
36 * what="checkboxName"
37 * contextVar="watijCheckbox"/>
38 * </watij-session>
39 * </testcase>
40 * </source></pre>
41 *
42 * Maybe there are several checkboxes buttons with the same name:
43 *
44 * <pre><source>
45 * <testcase xmlns="jelly:jameleon" xmlns:j="jelly:core">
46 * <watij-session baseUrl="http://some.url/some/path" beginSession="true">
47 * <watij-checkbox
48 * functionId="Gets a checkbox via its name and value"
49 * how="name"
50 * what="checkName"
51 * value="val2"
52 * contextVar="checkbox2"/>
53 * </watij-session>
54 * </testcase>
55 * </source></pre>
56 *
57 *
58 * See the javadocs on watij's {@link watij.finders.SymbolFactory SymbolFactory} for a complete list of supported symbols.
59 * @jameleon.function name="watij-checkbox" type="action"
60 */
61 public class WatijCheckboxTag extends WatijRadioTag {
62
63 public HtmlElement getHtmlElement(Symbol how, String what) throws Exception{
64 HtmlElement checkbox = null;
65 if (value != null) {
66 checkbox = ie().checkbox(how, what, value);
67 }else{
68 checkbox = ie().checkbox(how, what);
69 }
70 return checkbox;
71 }
72
73 public String getTagName(){
74 return "Checkbox";
75 }
76
77 }