Mouse hover action to browser window close button
I have a test scenario where the web application checks for the user's leave intent i.e., mouse hovering from the page to the browser close and then a frame gets triggered. Is there any way to do it?
Edit: So the dev implementation is that when the user is moving to the top of the document frame gets triggered and it is not browser close but moving to corner of the document.
Laycee last edited by
The browser close button cannot be hovered with WebDriver. You could try to close the current window with
driver.close()and see if the close is blocked and the message is shown.
- Move mouse top top of page: https://stackoverflow.com/questions/12974488/selenium-webdriver-move-mouse-to-point
- You could try to automate non browser page actions with SikuliX or AutoIt. Still I would try to not take this path, as it makes tests harder to setup, harder run (also on test servers), more complex to understand.
I would sit with the developers and see how you can make this testable as simple as possible. For example by implementing window.onbeforeunload to prevent the window from closing without confirmation, which is testable by using