我必须使用python(selenium)在网站上接受警报,
为此,我尝试了:
from selenium import webdriver
driver = webdriver.Chrome()
driver.get('http://mysite/which/shows/alert')
alert = driver.switch_to_alert()
但显示为
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.NoAlertPresentException:
Message: no such alert
(Session info: chrome=70.0.3538.102)
(Driver info: chromedriver=2.43.600210
我也尝试过
alertobj=driver.switch_to.alert
但存在相同的错误
谢谢