我无法使用Selenium关闭弹出框。下面是我写的代码,它会返回一个异常。请参阅下面的代码。无法使用Selenium关闭弹出框
driver = webdriver.Chrome()
driver.get("https://www.google.com/webhp#q=home+depot+san+francisco&lrd=0x808f7c5c63124c7b:0x32c19e9988b2aa90,1,")
driver.find_element_by_xpath('//div[@class="_wzh"]').click()
# selenium.common.exceptions.ElementNotVisibleException: Message: element not visible
感谢,
很好的回答。但我猜downvote是因为OP没有试图关闭浏览器警报,而是模拟相同的“模式对话框”。 –
@JohnMee - 谢谢!我没有看到实际的页面。根据我对这个问题的回答。 – Amit