1

I’ve been trying to handle alert in Selenium using chrome 54.0.2840.87 (currently the latest chrome version) and chromedriver 2.25 (currently the latest chromedriver) without success. I’ve made sure this is an alert and not a popup (There’s no inspect element option).

Also I’ve made sure that there’s no timing issue, by placing a breakpoint before the code which handle the alert, but it gives exception: org.openqa.selenium.NoAlertPresentException: no alert open

This is the code I’ve been trying to use, without success: driver.switchTo().alert().accept();

Also tried to wait for the alert to be present using the code, without success: wait.until(ExpectedConditions.alertIsPresent());

Also tried to use javascript executeScript to accept the alert without success: ((JavascriptExecutor)m_driver).executeScript("window.confirm = function(msg){return true;};");

Link to the alert I’ve received: https://i.stack.imgur.com/n8FcE.png

Thanks for your help.

Priyanshu
  • 3,040
  • 3
  • 27
  • 34
MosheG
  • 11
  • 2
  • Possible duplicate of [Bypass "External protocol request" popup during selenium automation](http://stackoverflow.com/questions/29554564/bypass-external-protocol-request-popup-during-selenium-automation) – stackoverflow Nov 08 '16 at 10:32

1 Answers1

0

This is not an alert box. So you won't be able to handle it in the traditional way. As a workaround, you can disable this protocol handler box from chrome Local State files.

For windows: The local state file can be found under C:\Documents and Settings\<USERNAME>\Local Settings\Application Data\Google\Chrome\User Data.

Edit the "Local State" file, and add a line under "caxhost": false, to include your protocol.

For linux: Follow steps from here: https://askubuntu.com/questions/465586/how-to-reset-external-protocol-handler-in-chrome

Community
  • 1
  • 1
Priyanshu
  • 3,040
  • 3
  • 27
  • 34
  • Thank you for your answer. If this is not an alert, then what is it? I need to accept this alert in order to run the application. Is there a robust way that I can do that? – MosheG Nov 14 '16 at 05:20
  • To read more about the alert box you can follow the https://en.wikipedia.org/wiki/Alert_dialog_box. The dialog box which you are trying to bypass is a different kind of popup which asks you to launch a different application. – Priyanshu Nov 14 '16 at 06:21
  • in coding terms javascript `alert()` is the function which pops up the dialog. – Priyanshu Nov 14 '16 at 06:22