如何使用硒单击打开的应用程序警报

问题描述 投票:0回答:1

我正在尝试使用Selenium单击打开的应用程序警报,并且出现此错误

NoAlertPresentException: Message: no such alert

所以基本上,我试图从浏览器中打开缩放应用程序

enter image description here

这是我的代码:

from selenium import webdriver
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.common.exceptions import TimeoutException

driver = webdriver.Chrome(executable_path='chromedriver/chromedriver') 
driver.get("https://zoom.us/j/93459172503?pwd=QkhnMEQ0ZTRZd0grUVJkT2NudmlFZz09")

try:
    WebDriverWait(driver, 5).until(EC.alert_is_present(), 'Timed out waiting for alerts to appear')
    alert = driver.switch_to.alert
    alert.accept()
    print("alert accepted")
except TimeoutException:
    print("no alert")
python python-3.x selenium selenium-webdriver
1个回答
0
投票
© www.soinside.com 2019 - 2024. All rights reserved.