推送用户名&使用Selenium python 3+提醒的密码

时间:2017-11-18 05:25:23

标签: javascript python selenium

Alert on website

大家好 我试图使用下面的代码接受警报,但我每次都会收到超时异常。尝试增加等待时间仍然是同样的错误

wait = WebDriverWait(driver, 60)
driver.get('abc.com')
alert = wait.until(EC.alert_is_present())  ----------Error at this line
time.sleep(4)
#WebDriverWait(driver, 3).until(EC.alert_is_present())
alert = driver.switch_to.alert
alert.send_keys('username' + Keys.TAB + 'password')
alert.accept()

错误: -

Traceback (most recent call last):
  File "C:\Users\Gaurav Chhabra\Desktop\FAIL_RATE.py", line 30, in <module>
    alert = wait.until(EC.alert_is_present())
  File "C:\Users\Gaurav Chhabra\AppData\Local\Programs\Python\Python35\lib\site-packages\selenium\webdriver\support\wait.py", line 80, in until
    raise TimeoutException(message, screen, stacktrace)
selenium.common.exceptions.TimeoutException: Message: 

在另一个网站上使用相同代码及其工作原因可能是什么原因,这是因为某些网站功能无法使用? 我还附上警报图像

或者是否有人可以通过一些新的方式来帮助我传递用户名&amp;此警报中的密码?

感谢

0 个答案:

没有答案
相关问题