Skip to content
Advertisement

How to verify ‘Open xdg-open popup’ in Chrome via Selenium Webdriver?

I am writing a testcase where if a certain link is clicked a “Open xdg-open” Popup is triggered in the chrome browser.

I want to verify in my testcase if an “Open xdg-open” Popup actually appears.

I tried to use the following Code block:

JavaScript

However the “Open xdg-open” Popup triggers the NoAlertPresentExcpetion even though it appears in the browser.

Do you have any clue how I can verify the “Open xdg-open” Popup?

Advertisement

Answer

It does not work because it’s not a DOM element you can switch to it. This kind of xdg-open alert happens whenever want to handle a protocol defined by user preferences. It could be any of (afp, Tel, disk, file, hcp, …)

You can use ChromeOptions in order to exclude these kind of schemes

JavaScript

You should change the protocol above with whatever protocol is on your side or use this code which exclude list of schemes

JavaScript
User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement