我無法使用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