1

When Selenium starts it opens the browser and starts to fill the data, but when the user clicks somewhere in the browser while the selenium is running, then selenium execution stops, which crashes my application, is it possible to handle such crashes

undetected Selenium
  • 183,867
  • 41
  • 278
  • 352
Grijan
  • 287
  • 5
  • 22

1 Answers1

4

When you use Selenium to execute your program/script, Selenium needs the focus on the Browser Client which renders the HTML DOM.

Now, when the test execution is In Progress if an user manually clicks somewhere withinin the browser, Selenium looses the focus and an exception will be raised.

undetected Selenium
  • 183,867
  • 41
  • 278
  • 352
  • If you use two monitor, then the case is different. While you use two monitor and if you use firefox brower, one monitor you can allow your automation and in another monitor you can continue to type something else but if you use chrome, then it's not possible because chrome needs the focus , so it pull the control from you. – Rajagopalan Jul 04 '18 at 17:07
  • 1
    so when selenium runs the user should keep his hands away from the browser right? – Grijan Jul 14 '18 at 02:14
  • 1
    @Grijan Yup, that's right, at the least no manual clicks on the browser session initiated by Selenium. – undetected Selenium Jul 14 '18 at 03:38
  • Find find many issues when the browser is obstructed by other windows too. Normally when in front it works fine. – arjun Feb 16 '23 at 03:46