Navigation Warning Popup Not Appearing During Automation

Haseeb zaidi 20 Reputation points
2025-02-06T11:39:05.7233333+00:00

I am facing an issue when running automation and editing form fields. When I try to leave the page and navigate to another page, the 'Do you want to leave?' popup does not appear. This behavior is expected to warn users about unsaved changes, but it seems to be missing during automation.
Edge version : 132:0:2957.140

Microsoft Edge
Microsoft Edge
A Microsoft cross-platform web browser that provides privacy, learning, and accessibility tools.
2,497 questions
{count} votes

Accepted answer
  1. ShiJieLi-MSFT 11,921 Reputation points Microsoft External Staff
    2025-02-07T06:52:04.3533333+00:00

    Hi @Haseeb zaidi ,

    Please note that this behavior is now by design that confirmation dialog (beforeunload event) won't show up when the browser is launched by WebDriver. WebDriver Classic protocol does not support this feature.

    As a workaround, you can enable WebDriver BiDi and set unhandledPromptBehavior to "ignore". Based on my test, the confirmation dialog appears as expected.

    If you have any feedback on this behavior, please leave a comment in the original Chromium issue post or create a new issue post there. Thanks for your understanding.


    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    Best Regards,

    Shijie Li

    0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.