mercredi 4 novembre 2020

How to select check box in selenium java, if we have two preceding check boxes

How does one select the check box in Selenium Java if we have two preceding checkboxes in Java?

enter image description here I want to select the check box inside

My code is below:

String xpath = "//h2[text()='Safeguard workplace']/following-sibling::div/descendant::label[text()='" + SafeguardWorkplace + "']/ancestor::div/preceding-sibling::input[@type='checkbox']";
WebElement element = findElement(By.xpath(xpath));
element.click();



Aucun commentaire:

Enregistrer un commentaire