Selenium click Event Sample Program in Java

Selenium click Event:

In the post, we are going to load site using selenium in java and JSP and Servlet page will be clicked after the page load.

Selenium Java Program to Click:



public class SeleniumClickEvent {
	public static void main(String[] args) {
		File file = new File("D:/IEDriverServer.exe");
		System.setProperty("", file.getAbsolutePath());
		InternetExplorerDriver driver = new InternetExplorerDriver();
		// The below line open the in IE browser
		// menu-item-1381 is the ID of the JSP and Servlet page of
		// site, so it will be clicked

1. will be opened in the IE browser.
2. JSP and Servlet Page will be clicked after the page load.

Here we performed click with ID using findElementById(). But the same can be achieved using any of the below,

1. findElementByClassName()
2. findElementByCssSelector()
3. findElementByLinkText()
4. findElementByName()
5. findElementByPartialLinkText() etc…

112 total views, 2 views today

Leave a Reply

Your email address will not be published. Required fields are marked *