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 gone by user.
but i can not detect the situation.
(1. "driver!=null" code is not working, because driver still exist after browser is closed by user)
(2. "if((driver.getWindowHandle().equals(""))" is not working, because Chrome Unrechable Exception, because browser is closed by user......
What i want to do is to check if the browser is gone, because of user,
Actual Behavior -
Codes example.
public String upBitpageOpen(Locale locale, Model model, HttpServletRequest httpServletRequest) {
if (driver != null) {
System.out.println("this is already exist driver");
System.out.println("this is windowHandle:"+driver.getCurrentUrl());
//driver.getCurrentUrl(), or driver.getWindowHandle() has the ERROR!!AFTER USER CLOSE THE BROWSER!!!
// SO I WANT CHECK IF THE BROWSER IS CLOSED BY USER
driver.close();
driver.quit();
} else {
System.out.println("there is No driver");
driver = new ChromeDriver();
}
driver.get("https://www.upbit.com");
driver.manage().window().maximize();
String ajaxResult = "success";
return ajaxResult;
}
Meta -
OS:
Selenium Version:
Browser:
Browser Version:
Expected Behavior -
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 gone by user.
but i can not detect the situation.
(1. "driver!=null" code is not working, because driver still exist after browser is closed by user) (2. "if((driver.getWindowHandle().equals(""))" is not working, because Chrome Unrechable Exception, because browser is closed by user......
What i want to do is to check if the browser is gone, because of user,
Actual Behavior -
Codes example.
public String upBitpageOpen(Locale locale, Model model, HttpServletRequest httpServletRequest) { if (driver != null) { System.out.println("this is already exist driver"); System.out.println("this is windowHandle:"+driver.getCurrentUrl()); //driver.getCurrentUrl(), or driver.getWindowHandle() has the ERROR!!AFTER USER CLOSE THE BROWSER!!! // SO I WANT CHECK IF THE BROWSER IS CLOSED BY USER