0

I am automating the testing process of installing a plugin in selenium right now. I am well aware you can include chrome plugins in the chromeOptions but what I want to test here is the process of manually installing the extension and how my web app reacts to it.

After clicking the "Add to Chrome" button in the web store, a prompt appears and you have to click "Add extension". I already know it is not possible to confirm this prompt using selenium, so my idea is to allow installing extensions without any prompts. According to this I can use the --prompt-for-external-extensions flag to disable those prompts.

All my attempts to add this flag to the ChromeOptions so far have failed and the prompt still appears. I am also unsure whether the precondition The constant CHROMIUM_BUILD must be defined. is fulfilled.

My attempts:

ChromeOptions options = new ChromeOptions();
options.addArguments("--prompt-for-external-extensions");
//or this
options.setExperimentalOption("excludeSwitches", Arrays.asList("prompt-for-external-extensions"));

How can I succesfully disable this prompt in chrome?

Carle B. Navy
  • 1,156
  • 10
  • 28
  • 1
    This switch takes also a true/false value. However `CHROMIUM_BUILD` is a compile time constant only present in Chromium, not in Chrome. See [source](https://github.com/chromium/chromium/blob/67c0ef1c7f3c7671b439d8a7882e80d505844b2b/extensions/common/switches.cc#L74). – skandigraun Sep 25 '18 at 18:13
  • 1
    Also, looking a bit more into the code, it seems that it is not possible to disable this prompt. The method that handles it always returns false/null on chrome (or to be more exact: when it is not chromium, when the constant is not defined). Well... try Chromium? Should work the same as Chrome. – skandigraun Sep 25 '18 at 18:25
  • It should be possible to click an arbitrary screen position from your test host app so you can either click at a hardcoded position relative to the browser window position or try enumerating the browser windows by their internal handle, get their size and positions, etc. – wOxxOm Sep 26 '18 at 04:07
  • Did you find the solution? – Vaibhav Grover May 14 '19 at 10:11

0 Answers0