I am having trouble getting some checkboxes to be clicked. the usual XPath does not work, and there is no ID. I have attached the HTML code.
Asked
Active
Viewed 28 times
2 Answers
1
driver.findElement(By.className("custom-control-label")).click();
Try above line. Thanks.

Fahim Bagar
- 798
- 7
- 17

Gobinda
- 7
- 5
0
To click()
on the element you can use either of the following Locator Strategies:
cssSelector
:driver.findElement(By.cssSelector("input#contactAuth")).click();
xpath
:driver.findElement(By.xpath("//input[@id='contactAuth']")).click();
Ideally, to click()
on the element, you need to induce WebDriverWait for the elementToBeClickable()
and you can use either of the following Locator Strategies:
cssSelector
:new WebDriverWait(driver, 20).until(ExpectedConditions.elementToBeClickable(By.cssSelector("input.birtviewer_clickable[name='exportReport']"))).click();
xpath
:new WebDriverWait(driver, 20).until(ExpectedConditions.elementToBeClickable(By.xpath("//input[@class='birtviewer_clickable']"))).click();

undetected Selenium
- 183,867
- 41
- 278
- 352