Skip to content Skip to sidebar Skip to footer

Python-selenium Finds Clickable Element That Cannot Be Clicked

I am using python-selenium to run automated tests. In the complex non-public environment these tests are running in I found something what I would label as a bug in selenium. Basi

Solution 1:

The reason it fails because ElementToBeClickable is waiting for element to be enabled, it's not really checking whether the element is clickable, it is assuming element is clickable if element is enabled, it's true actually but it fails here because element is enabled even when another element is overlay the desired element.

So write this code for the overlay to disappear

WebDriverWait(bspdriver.webdriver,10).until(EC.invisibility_of_element_located((By.XPATH, "//div[@class='ivu-modal-wrap vertical-center-modal circuit-loading-modal']")));

And then you write your code

what = (By.XPATH, '//button/span[contains(text(), "Load")]')
element = WebDriverWait(bspdriver.webdriver, 60).\
                until(EC.element_to_be_clickable(what))
element.click()

The above solution would work if the overlay is temporary, If it's permanant, then perform the Javascript click, because WebDriver internal check would stop you to do the click.

Post a Comment for "Python-selenium Finds Clickable Element That Cannot Be Clicked"