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 radio button on the page and stores in the context.
27 *
28 * An example might be to get a radio 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-radio
34 * functionId="Gets a radio button vi its name"
35 * how="name"
36 * what="radioName"
37 * contextVar="watijRadio"/>
38 * </watij-session>
39 * </testcase>
40 * </source></pre>
41 *
42 * Maybe there are several radio 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-radio
48 * functionId="Gets a radio button via its name and value"
49 * how="name"
50 * what="radioName"
51 * value="val2"
52 * contextVar="watijRadio"/>
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-radio" type="action"
60 */
61 public class WatijRadioTag extends AbstractWatijGetTag {
62
63 /***
64 * The value of the form field.
65 * This is for form fields that all have the same name,
66 * but different values.
67 * @jameleon.attribute
68 */
69 protected String value;
70
71 public HtmlElement getHtmlElement(Symbol how, String what) throws Exception{
72 HtmlElement radio = null;
73 if (value != null) {
74 radio = ie().radio(how, what, value);
75 }else{
76 radio = ie().radio(how, what);
77 }
78 return radio;
79 }
80
81 public String getTagName(){
82 return "Radio";
83 }
84
85 }