I'm trying to log in to Python Selenium, but I can't click because of the pop-up image.

Asked 2 years ago, Updated 2 years ago, 42 views

You are about to write a code that automatically logs in to the < site. However, sometimes unexpected pop-up support appears. It seems to be used occasionally to announce events on the site. The problem is that if the pop-up image appears, the login button is covered by the image The following error occurs because the button cannot be clicked.

selenium.common.exceptions.WebDriverException: Message: unknown error: Element ... is not clickable at point (831, 682). Other element would receive the click:

How do we solve this problem? You should not try JavaScript, such as driver.execute_script ("arguments[0].click();", login_elm). Of course, if the pop-up image does not appear, it automatically logs in normally.

And you might misunderstand because it's a pop-up image, but it's not a pop-up window. It looks like a pop-up window, so that's what I'm saying. In fact, it's an img tag in the url's html code It's represented. The problem is that the image pops up on the screen and the element behind it is covered. (In my case, it seems that the login button is covered by the image and cannot be clicked.)

python selenium

2022-09-22 18:53

1 Answers

Simply remove the display property of that layer by giving it none.

from selenium import webdriver

driver = webdriver.Chrome('CHROME_DRIVER_PATH')
driver.get('https://www.happycampus.com/')
driver.execute_script("document.getElementById('fontBadaEventPopup').style.display='none';")


2022-09-22 18:53

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.