selenium - 如何自动化使用外部应用程序的网站?

标签 selenium google-chrome automation puppeteer webdriver-io

Open ExternalApplication?

https://webiste.com wants to open this application.

[x] Always allow website.com to open links of this type in the associated app

[Cancel] [Open ExternalApplication]


我正在尝试自动化使用外部应用程序的流程。 Chrome 正在请求打开应用程序的权限(见上文),但我无法找到一种方法来自动与该对话框进行交互。
有人建议我通过将命令行参数传递给 Chrome 来禁用该对话框。我得到了这个 list ,但它很大,我找不到任何看起来有用的东西。
如果有人曾经设法使使用外部应用程序的东西自动化,请告诉我你是如何做到的。谢谢。
编辑:
这些是自动化框架用于启动 Chrome 的参数:

Launch Google Chrome with flags: --enable-automation --disable-popup-blocking --disable-extensions --disable-background-networking --disable-background-timer-throttling --disable-backgrounding-occluded-windows --disable-sync --metrics-recording-only --disable-default-apps --mute-audio --no-first-run --no-default-browser-check --disable-hang-monitor --disable-prompt-on-repost --disable-client-side-phishing-detection --password-store=basic --use-mock-keychain --disable-component-extensions-with-background-pages --disable-breakpad --disable-dev-shm-usage --disable-ipc-flooding-protection --disable-renderer-backgrounding --force-fieldtrials=*BackgroundTracing/default/ --enable-features=NetworkService,NetworkServiceInProcess --disable-features=site-per-process,TranslateUI,BlinkGenPropertyTrees --window-position=0,0 --window-size=1200,900


我可以轻松添加标志。不确定删除标志。

最佳答案

这并不理想,但它是一种解决方法:

remote({
    logLevel: 'trace',
    capabilities: {
        browserName: 'chrome',
        'goog:chromeOptions': {
            args: ['--user-data-dir=./profile']
        }
    }
})
通过设置用户数据目录,您可以在第一次运行时手动授予始终允许权限,然后将保存并记住以备将来运行。我还没有检查将其提交到您的存储库是否可行,但这可能使其在任何其他系统上工作而无需进行初始设置。
作为旁注,我发现 puppeteer 有能力 override permissions ,但没有提到打开外部应用程序。如果支持,我认为这将是理想的解决方案。

关于selenium - 如何自动化使用外部应用程序的网站?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/65238369/

相关文章:

python - 在 Selenium 中找到该元素的最佳方法?

ios - 使用 appium 访问 iOS 控制中心

java - 如何在服务器端进行网页抓取?

java - selenium-java-2.43.0 不适用于 firefox 36

c# - Selenium Chrome 问题 - 显示警报时执行在 GoToUrl() 处停止

java - 使用 selenium.setSpeed() 时返回错误 "Multiple markers at this line - Syntax error on token "

google-chrome - 如何在 Chrome 扩展程序中 Hook 下载?

css - Chrome 和 Firefox CSS 边框问题

javascript - 使用全屏 API 制作视频全屏

javascript - 自动 console.log 脚本中所有变量的名称和值