aquality-automation / aquality-selenium-dotnet

Aquality Selenium is a library built over Selenium WebDriver tool that allows to automate work with web browsers. Selenium WebDriver requires some skill and experience. So, Aquality Selenium suggests simplified and most importantly safer and more stable way to work with Selenium WebDriver.
Apache License 2.0
47 stars 14 forks source link

Unable to disable pop-up on Edge #244

Closed aarif313 closed 8 months ago

aarif313 commented 9 months ago

While executing test cases on Edge browser I am getting below pop-up

image

I have made below setting for Edge browser in my settings.json file

"edge": { "webDriverVersion": "MatchingBrowser", "capabilities": { "enableVNC": true, "unhandledPromptBehavior": "default" }, "options": { "intl.accept_languages": "en", "safebrowsing.enabled": "true", "profile.default_content_settings.popups": "0", "disable-popup-blocking": "true", "download.prompt_for_download": "false", "download.default_directory": "./downloads" }, "excludedArguments": [], "startArguments": [ "--ignore-ssl-errors=yes", "--ignore-certificate-errors" ] }

But still this pop-up continues to appear.

Please help

aarif313 commented 9 months ago

the web elements are hiding behind popup hence not able to perform any action on it and test cases are failing

mialeska commented 9 months ago

Hi @aarif313 ! I have not seen such popup before, maybe you could share me the source code of it? I believe you should be able to work with this popup as with UI elements, e.g. find the close button using some locator and click on it.

After some googling I've found the suggestion https://answers.microsoft.com/en-us/microsoftedge/forum/all/how-to-stop-annoying-pop-up-asking-to-download/b2e13675-3249-4107-99ee-7838f17ceabf to disable policy with preference key name ShowRecommendationsEnabled. I have found that it could be disabled in registry, unfortunately haven't found related capability image

mialeska commented 9 months ago

@aarif313 you might also try adding startArgument "-inprivate", then you should not be seeing excessive popups (as in private mode) image

mialeska commented 9 months ago

you can also find a lot of supported start arguments for edge to experiment with here: https://github.com/seleniumbase/SeleniumBase/blob/master/seleniumbase/core/browser_launcher.py#L2554

aarif313 commented 9 months ago

@mialeska Thanks for your response, Let me try this. Will update you soon.

aarif313 commented 8 months ago

Hi @mialeska

Adding a startArgument "-inprivate" creating another issue, getting below error

OpenQA.Selenium.WebDriverException : unknown error: unhandled inspector error: {"code":-32000,"message":"Failed to open new tab - no browser is open"} (Session info: MicrosoftEdge=120.0.2210.77)

This is already reported at below thread, https://github.com/SeleniumHQ/selenium/issues/11729

mialeska commented 8 months ago

Hi @aarif313 ! Are you getting this error on attempt to open a new tab? If yes, then javascript method should work for you: AqualityServices.Browser.Tabs().OpenNewTabViaJs();

aarif313 commented 8 months ago

Hi @mialeska

I added startArgument as "-inprivate" for Edge browser and to open new tab used AqualityServices.Browser.Tabs().OpenNewTabViaJs(); and this solved pop up issue in Edge browser and pop up is no more appearing.

Thanks a ton.

Marking it as Closed.