View Javadoc

1   /*
2       Jameleon Selenium plug-in - A plug-in that uses Selenium (http://www.openqa.org/selenium/) to drive web sites
3       Copyright (C) 2006 Christian W. Hargraves (engrean@hotmail.com)
4       
5       This library is free software; you can redistribute it and/or
6       modify it under the terms of the GNU Lesser General Public
7       License as published by the Free Software Foundation; either
8       version 2.1 of the License, or (at your option) any later version.
9   
10      This library 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 GNU
13      Lesser General Public License for more details.
14  
15      You should have received a copy of the GNU Lesser General Public
16      License along with this library; if not, write to the Free Software
17      Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18  */
19  package net.sf.jameleon.plugin.selenium.tags;
20  
21  
22  /***
23   * Clicks on an HTML element.
24   * 
25   * To click on a link with the text <b>Link 1</b>:
26   * <pre><source>
27   *     &lt;selenium-click
28   *            functionId="Click on 'Link 1'"
29   *            locator="link=Link 1" /&gt;
30   * </source></pre>
31   * To click on a submit button with the name <b>submit_name</b>:
32   * <pre><source>
33   *     &lt;selenium-click
34   *            functionId="Click the submit button named 'submit_name'"
35   *            locator="submit_name" /&gt;
36   * </source></pre>
37   * Refer to the Selenium javadocs for more information.
38   * @jameleon.function name="selenium-click" type="action"
39   */
40  public class SeleniumClickTag extends AbstractSeleniumLocatorTag{
41  
42      /***
43       * The max number of milliseconds to wait for the page to load
44       * @jameleon.attribute
45       */
46      protected String waitForPageToLoad;
47  
48      public void testBlock(){
49          session.click(locator);
50          if (waitForPageToLoad != null) {
51              session.waitForPageToLoad(waitForPageToLoad);
52          }
53      }
54  }