Search code examples
selenium-webdrivermicrosoft-edgedesiredcapabilitiesselenium-edgedriver

What is the Desired Capabilities to handle this popup of Microsoft Edge?


There is popup which raised when trying to close tab of Microsoft Edge browser,

Do we have any capabilities by which it can be control ?

Or is there any relevant settings, from which it may not ask.

Tried : driver.switchTo().alert().accept();

But it was not controlled.


Solution

  • This message can be occur when user had fill some data in the form of webpage and try to close the tab.

    To avoid this message, user can clear the data may help to suppress the message.

    In JQUERY, User can try to use $(window).off('beforeunload'); or $(window).off('beforeunload.windowReload');

    Calling .off() with no arguments removes all handlers attached to the elements. Specific event handlers can be removed on elements by providing combinations of event names, namespaces, selectors, or handler function names.

    Reference:

    jQuery docs

    You can also try to make a test with other browsers and check whether you receive same message or not. If there is specific steps to produce the issue then try to provide us. We will try to make a test with it and try to find a solution or work around for it.