How to automate a website that uses an external application?

Viewed 614

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]

I'm trying to automate a flow that uses an external application. Chrome is asking for permission to open the application (see above), but I'm not able to find a way to automate the interaction with that dialog.

It was suggested to me that I might be able to disable that dialog by passing command line arguments to Chrome. I was given this list, but it's massive and I'm not finding anything that looks helpful.

If anyone has ever managed to automate something that uses an external application, please let me know how you did it. Thanks.

EDIT:

These are the arguments used to launch Chrome by the automation framework:

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

I can easily add flags. Not sure about removing flags.

1 Answers

It's not ideal, but it's a workaround:

remote({
    logLevel: 'trace',
    capabilities: {
        browserName: 'chrome',
        'goog:chromeOptions': {
            args: ['--user-data-dir=./profile']
        }
    }
})

By setting the user data dir, you can manually give always allow permissions on the first run and then that will be saved and remembered for future runs. I haven't checked whether it's feasible to commit this to your repository, but that could potentially make it work on any other system without having to do that initial setup.

As a side note, I found out that puppeteer has the ability to override permissions, but there is no mention of opening external applications. If that was supported, I think that would be the ideal solution.

Related