Interview Questions

Selenium WebDriver - How to check all checkboxes in a page ?

Selenium WebDriver Interview question and Answers


(Continued from previous question...)

Selenium WebDriver - How to check all checkboxes in a page ?

List<webElement> chkBox = driver.findElements(By.xpath(//htmltag[@attbute='checkbox'])); for(int i=0;
i<=chkBox.size(); i++){ chkBox.get(i).click(); }


List<webElement> chkBox = driver.findElements(By.xpath(//htmltag[@attbute='checkbox']));


for(int i=0; i<=chkBox.size(); i++){

chkBox.get(i).click();
}

(Continued on next question...)

Other Interview Questions