0

I am trying to press the "Open (Application name)" button that pops up on selenium, however, when I go to inspect element it does not appear to be an element. I tried pynput, but it doesn't work when tabbed out.

Any help would be appreciated, thanks.

  • Does this answer your question? [How to automatically accept Chrome's "Always open these types of links in the associated app" dialogs in Selenium](https://stackoverflow.com/questions/48683177/how-to-automatically-accept-chromes-always-open-these-types-of-links-in-the-as) – CherryDT Apr 19 '20 at 16:32
  • No, it doesn't because there is no checkbox to automatically accept. –  Apr 19 '20 at 17:37
  • Did you try the mentioned solutions though? Especially the one about passing the `excluded_schemes` preference with the right protocol. I think it should make this popup be skipped and the app always automatically open – CherryDT Apr 19 '20 at 17:57
  • It's the same prompt, it's just that Chrome 77 removed the checkbox by default. (More details [here](https://textslashplain.com/2019/08/29/web-to-app-communication-app-protocols/), also describing how to bring it back, so you can also try the second solution in the other thread) – CherryDT Apr 19 '20 at 17:59
  • I'm using python, so the second answer on that thread doesn't work. –  Apr 19 '20 at 18:20
  • Please don't dismiss everything so easily just because it's not 100% right out of the box... googling `chrome selenium python pass preference` shows you how to pass Chrome preferences using Python too... for example [like this](https://stackoverflow.com/questions/43347044/python-selenium-set-multiple-chrome-preference) - I'm not all-knowing either, I just search those answers in Google, essentially! – CherryDT Apr 19 '20 at 18:22
  • How do I know what to type in for the protocol name? –  Apr 19 '20 at 19:05
  • The protocol of the link which causes the popup to appear. For example, a URL that opens the Slack application may look like this `slack://open`, then the protocol is `slack`. – CherryDT Apr 19 '20 at 19:06
  • This is my code for what you told me to do. `prefs = {"protocol_handler": {"excluded_schemes": {"Roblox": "false"}}}` I suspect I'm using the wrong protocol name since it is not working. I made sure to add it as an experimental option and then pass the options to the driver. –  Apr 19 '20 at 19:46
  • 1
    Nevermind! I solved it. The protocol name was "roblox-player". Thanks for helping! –  Apr 19 '20 at 21:07
  • Great, happy to hear that! To help others, could you maybe submit your final solution as an answer to your own question below, and self-accept it? Then next time someone using Python like you could find the right code, like you hoped for :) – CherryDT Apr 19 '20 at 22:32

1 Answers1

1

To bypass the open application dialog on selenium, you need to create an "exception".

This code should work:

options = webdriver.ChromeOptions()
prefs = {"protocol_handler": {"excluded_schemes": {"<INSERT PROTOCOL NAME>": "false"}}}
options.add_experimental_option("prefs", prefs)
driver = webdriver.Chrome("./chromedriver.exe", options=options)