Skip to content Skip to sidebar Skip to footer

Selenium Can't Click Element Because Other Element Obscures It

Set-up I'm using Python 3.x and Selenium to fill out a query field and subsequently click the search button, # element containing the product search bar and buttons search_area = e

Solution 1:

Following nr.5 of DebanjanB's answer, I solved it by implying the code to wait for the temporary overlay to dissapear before trying to click,

wait.until(EC.invisibility_of_element_located((By.XPATH,
              "//div[@class='blockUI blockOverlay']")))
el_xp("//input[@value='Save']").click()

Solution 2:

There are several ways to do this, one of the ways is by Javascript executor.

You could say:

element = driver.find_element_by_xpath("//div[@class='blockUI blockOverlay']")

driver.execute_script("arguments[0].style.visibility='hidden'", element)

This way, you can block the div with class = 'blockUI blockOverlay' and your element can be clicked if I'm correct.

Solution 3:

Also, you can try to click the element by JavaScript like this:

# element containing the product search bar and buttons
search_area = el_id('Products').find_element_by_class_name('searchArea')

# click element by executing javascript
driver.execute_script("arguments[0].click();", search_area)

Post a Comment for "Selenium Can't Click Element Because Other Element Obscures It"