0

I have a page as this, enter image description here

And I want to click the top checkbox, which by default, would automatically select all the checkboxes in that list. As you can see, I have created the xpath value, and it matches the checkbox area that I want to pick. But when I was to have it executed in selenium, the checkbox checking never happens.

 xpath_var = "//th[@class='selection-cell-header']/div[1]/input[1]"
    WebDriverWait(self.driver, 30).until(
        EC.element_to_be_clickable((By.XPATH, xpath_var,))).click()

And here is the exception I have received:

      selenium.common.exceptions.ElementClickInterceptedException: Message: element click intercepted: Element <input class="ftnt-checkbox" readonly="" type="checkbox" id="" value=""> is not clickable at point (305, 162). 
Other element would receive the click: <label for="ftnt-checkbox"></label>

Any idea what could be wrong ? work around for such case? Manual clicking was ok, in that case.

Thanks,

Chun

user3595231
  • 711
  • 12
  • 29

1 Answers1

1

The exception message indicates that there is another element that will receive the click. This is a kind of protection in Selenium.
You can try to click this label that is on top of your element. Or click the parent div. Or click your element with JavaScript.

WebElement element = driver.findElement(By.id("gbqfd"));
JavascriptExecutor executor = (JavascriptExecutor)driver;
executor.executeScript("arguments[0].click();", element);

Reference: How to click an element in Selenium WebDriver using JavaScript?

K. B.
  • 3,342
  • 3
  • 19
  • 32