5

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.

Erik B
  • 40,889
  • 25
  • 119
  • 135
  • Is this when you try to download a file? Or click a link (like e-mail or phone number)? – DMart Dec 10 '20 at 16:26
  • This was answered over on SuperUser: https://superuser.com/a/1518982/997288 – WSC Dec 10 '20 at 16:32
  • @WSC That is certainly interesting, but I don't see how I can incorporate that into my automation. My normal Chrome browser is already configured to always allow that protocol. The Chrome instance launched by the automation framework always asks, even if I check the always allow box. It makes sense, considering that you don't want the behaviour to depend on user settings on the local system when running automation. I can update my answer with the flags it uses to launch Chrome, if you want to know how it is launched. – Erik B Dec 10 '20 at 17:46
  • @DMart It's a custom link to open a specific app. Like when you click on a link to join an MS Teams meeting for instance. In this case the app just performs some background task and reports back to the website. – Erik B Dec 10 '20 at 17:57
  • So you want to test the functionality of the browser launching a 3rd party app? What is your end goal of this project? – DMart Dec 10 '20 at 21:48
  • @DMart It's part of the journey. The third party app is launched, runs a task and the result is shown in the browser. I don't need to do anything with the 3rd party app, I just need it to run so that the journey carries on. – Erik B Dec 10 '20 at 21:51
  • you'll need an OS automation framework to handle that app. – DMart Dec 10 '20 at 21:53
  • @DMart Not really. If it has permission to run, all I need is browser automation. I don't really want to add another automation framework just to interact with that dialog. – Erik B Dec 10 '20 at 22:03
  • You said you need to interact with this 3rd party software? You're downloading a file and opening it with additional software? – DMart Dec 11 '20 at 00:07
  • I would suggest downloading the file, then running a command that opens it with the 3rd party – DMart Dec 11 '20 at 00:08

1 Answers1

-1

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.

Erik B
  • 40,889
  • 25
  • 119
  • 135