OS:Window 10
Browser: Chrome webDriver
Browser Version: Chrome 63.0.3239.10(64bit)
- Selenium Version 2.44
Added below dependency :
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>2.44.0</version>
</dependency>
Expected Behavior -
I want check if the driver is closed by user directly, and restart the webdriver if there is no browser.
Before Driver webdriver = new ChromeDriver()
codes, the webdriver is null state,
but after Driver webdriver = new ChromeDriver()
code finished, even if user close the browser, webdriver is not destroyed.
so, after user close the browser, all code related to webdriver has the error:: "unreachable Exception".
I want restart the webdriver, if the browser is closed by user, but I can not detect the situation.
driver!=null
code is not working, because driver still exist after browser is closed by userif((driver.getWindowHandle().equals(""))
is not working, because Chrome Unreachable Exception, because browser is closed by user
What I want to do is to check if the browser is gone, because of user?
driver.toString().contains("null")
) #27616970 – Gluteus