google chrome – Java Selenium WebDriver closes the web browser after reaching the last line of code?
There are some options on keeping the browser open after the last line of code. Not sure why would you use it, but hopefully this helps.
If you are waiting for an element or some action, you can always use wait.
With that, your browser will stay open until the element you’re waiting for has appeared or the wait timeout has expired (you define your own timeout duration). For more information visit this link
On the other hand, which I do not recommend, you can use Thread.sleep. It keeps the driver open, but in a sleep position. This method is not recommended though.
Read more here: Source link
