gpt4 book ai didi

python - 如何使用 Selenium 单击打开的应用程序警报

转载 作者:行者123 更新时间:2023-12-04 01:24:22 26 4
gpt4 key购买 nike

我正在尝试使用 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")

最佳答案

因为这不是浏览器警报,而是操作系统应用选择器,所以您无法在 Selenium 中与其交互。

见:Selenium C# How to handle Alert "Open Pick an app"?

默认情况下,您可以使用 --disable-default-apps 阻止这些应用程序选择器。启动 Chrome 时标记。

关于python - 如何使用 Selenium 单击打开的应用程序警报,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62154160/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com