Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

python selenium click blocked by popup

when I attempt to click a button located behind a popup menu I receive the following error message.

*** selenium.common.exceptions.ElementClickInterceptedException: Message: Element <input id="submitButton" class="search-button icon-search active" type="submit"> is not clickable at point (729.2000122070312,22) because another element <div id="monetate_lightbox_mask" class=""> obscures it

This error message is able to identify the name of what is blocking my click

How can I get this name (as an element) so that I can make modifications such as,

element = <div id="monetate_lightbox_mask" class="">

browser.execute_script("""var element = arguments[0]; element.parentNode.removeChild(element);""", element)

The wait function is not applicable as this popup does not go away. I have tried webdriver.ActionChains, but it doesn't not solve this issue

like image 774
Rhys Avatar asked Oct 28 '25 14:10

Rhys


1 Answers

Another interesting workaround would be to perform that click via javascript - in that case, it would not matter what is in front of it or blocking it:

submit_button = driver.find_element_by_id("submitButton")
driver.execute_script("arguments[0].click();", submit_button)

Also, be aware of the differences between a regular selenium click and click via javascript:

  • WebDriver click() vs JavaScript click()
like image 136
alecxe Avatar answered Oct 31 '25 04:10

alecxe



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!