View Javadoc

1   /*
2       Jameleon Watij plug-in - A plug-in that uses Watij (http://www.watij.com/) to drive web sites
3       Copyright (C) 2008 Christian W. Hargraves (engrean@hotmail.com)
4   
5       This program is free software; you can redistribute it and/or modify
6       it under the terms of the GNU General Public License as published by
7       the Free Software Foundation; either version 2 of the License, or
8       (at your option) any later version.
9   
10      This program is distributed in the hope that it will be useful,
11      but WITHOUT ANY WARRANTY; without even the implied warranty of
12      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13      GNU General Public License for more details.
14  
15      You should have received a copy of the GNU General Public License
16      along with this program; if not, write to the Free Software
17      Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
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 text, password, or textarea field and stores it in the context for use in another tag or the script.
27   * 
28   * Some example uses might be:
29   * 
30   * To get the text field defined by <input type="text" name="textField1"</a>
31   * <pre><source>
32   *  &lt;watij-text-field functionId="Get the text field named 'textField1'"
33   *       how="name"
34   *       what="textField1"
35   *       contextVar="tField"/&gt;
36   * </source></pre>
37   * 
38   * To get the text field defined by &lt;input type="text" id="textField1"&lt;/a&gt; 
39   * <pre><source>
40   *  &lt;watij-text-field functionId="Get the text field with the id'textField1'."
41   *       how="id"
42   *       what="textField1"
43   *       contextVar="textField"/&gt;
44   * </source></pre>
45   * 
46   * To get the text field defined by &lt;input type="text" id="textField1"&lt;/a&gt; which exists in a form named 'form1' 
47   * <pre><source>
48   *  &lt;watij-set-text-field functionId="Get a text field via xpath"
49   *       how="xpath"
50   *       what="//FORM[@name='form1']//INPUT[@type='password' and @id='textField1']"
51   *       contextVar="textField"/&gt;
52   * </source></pre>
53   * 
54   * See the javadocs on watij's {@link  watij.finders.SymbolFactory SymbolFactory} for a complete list of supported symbols.
55   * 
56   * @jameleon.function name="watij-text-field" type="action" 
57   */
58  public class WatijTextFieldTag extends AbstractWatijGetTag {
59  
60      public HtmlElement getHtmlElement(Symbol how, String what) throws Exception{
61          return ie().textField(how, what);
62      }
63  
64      public String getTagName(){
65          return "Text Field";
66      }
67  }