如何使用selenium与系统弹出窗口通信?

如何使用selenium与系统弹出窗口通信?,selenium,selenium-webdriver,webdriver,selenium-chromedriver,Selenium,Selenium Webdriver,Webdriver,Selenium Chromedriver,im使用selenium实现自动化,在im自动化过程的某些部分,我会弹出一个系统,如下所示: 我想点击“ok”,我该怎么做 谢谢 答复: 提供windows GUI交互。在macOS上尝试AppleScript。它可以处理系统弹出窗口 tell application "System Events" to tell process "NotificationCenter" click last item of windows end tell 示例是如何单击系统弹出窗口 tell a

im使用selenium实现自动化,在im自动化过程的某些部分,我会弹出一个系统,如下所示:

我想点击“ok”,我该怎么做

谢谢

答复:


提供windows GUI交互。

在macOS上尝试AppleScript。它可以处理系统弹出窗口

tell application "System Events" to tell process "NotificationCenter"
    click last item of windows
end tell
示例是如何单击系统弹出窗口

tell application "System Events" to tell process "NotificationCenter"
    click last item of windows
end tell

也许你可以修改它以用于你的案例

我想用selenium@JoeSelenium没有此选项。我是否可以单击ENTER?因为ok是默认选择的,我只需要点击enter@Joe我不知道,试试
Actions action=新操作(驱动程序);action.KeyDown(OpenQA.Selenium.Keys.Enter)
action.SendKeys(OpenQA.Selenium.Keys.Enter).Perform()这是C#语法,类似于java和python