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.



  • 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.

    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 driver.close().



Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2