Home > Mobile >  When running the test(selenium) the browser window opens but disappears after a while
When running the test(selenium) the browser window opens but disappears after a while

Time:06-09

I am just starting my adventure with Selenium. I have created a simple test that goes through the main page with the timetable until it hits the indicated teacher and retrieves the data from the timetable.

The whole operation succeeds without any problems and prints in the console the expected result.

However there is a problem, namely when I run the test, a browser which takes the webDriver (in this case Firefox) opens and within a few seconds after jumping to the indicated pages it fetches the data and automatically closes (the whole operation takes about 1-2 seconds) and in the console, apart from the result, an error appears:

I don't know if this is the way it should work, or if the page should stay open after the operation until I turn it off

CodePudding user response:

The @AfterEach annotation contains the method tearDown() where you have:

webDriver.quit();

So after each test, webDriver.quit(); is performed which not only closes the browser but ideally DELETEs the current webdriver session and the browsing session through sending "quit" command with {"flags":["eForceQuit"]} and finally sends the GET request on /shutdown EndPoint.


References

You can find a couple of relevant detailed discussion in:

  • Related