WebDriver driver = new FirefoxDriver();
driver.get("file:///D:/SameName.html");
driver.manage().window().maximize();
List<WebElement> cbox = driver.findElements(By.name("chk"));
cbox.get(cbox.size()-1).click();
In the above code we are getting all elements using locator name and value "chk" into a List
Then we are calling the get method on the list object by passing the index value and the performing the action.
No comments:
Post a Comment