Click on link

/**
 * Click on a simple link(e.g Next)
 * Assume that you have Internet Explorer and Selenium Server is running on your
 *  computer on default port 4444. Otherwise, change accordingly in the constructor.
 * @Author: Xuan Ngo
 */
import com.thoughtworks.selenium.DefaultSelenium;
 
public class ClickSimple
{
  private DefaultSelenium m_oBrowser = null;
 
  public static void main(String[] args)
  {
    ClickSimple oClickSimple = new ClickSimple();
 
    // Click on Next link.
    oClickSimple.runExamples();
  }
 
  // Constructor
  public ClickSimple()
  {
    this.m_oBrowser = new DefaultSelenium("localhost", 4444, "*iexplore", "http://openwritings.net/");
    this.m_oBrowser.start(); // Start Selenium.
    this.m_oBrowser.open("http://openwritings.net/sites/default/files/clickLinkTest.html"); // Open the webpage.
  }
 
  // Click on Next link.
  public void runExamples()
  {
    this.m_oBrowser.click("link=Next"); // Click on Next link.
 
    //this.m_oBrowser.stop(); // Close Selenium.
  }
}
AttachmentSize
HTML icon clickLinkTest.html146 bytes
HTML icon clickLinkTest_result.html131 bytes