How to Detach Chrome Browser from Chrome Driver (Selenium Web Driver C#) How to Detach Chrome Browser from Chrome Driver (Selenium Web Driver C#) selenium selenium

How to Detach Chrome Browser from Chrome Driver (Selenium Web Driver C#)


We can detach chrome instance from chromedriver using "detach" options.

Sample Code:

ChromeDriverService cdservice = new ChromeDriverService.Builder()                .usingDriverExecutable(new File("/path/to/chromedriver.exe"))                .withLogFile(new File("/path/to/chromedriver.log"))                .usingAnyFreePort().withVerbose(true).build();cdservice.start();ChromeOptions options = new ChromeOptions();options.setExperimentalOption("detach", true);ChromeDriver driver = new ChromeDriver(cdservice,options);driver.manage().timeouts().implicitlyWait(1, TimeUnit.MINUTES);driver.get("http://www.google.com/");// Do not call driver.quit().. instead stop chromedriver service.cdservice.stop();


This is simply not possible, that kind of separation does not exist.


chromeservice.driver.close()

has worked for me in the past but in this case you may need to write some coding for a method.