我想在VS 2010 C#中使用Selenium Web Driver打开Chrome浏览器,导航到某个网页,然后关闭驱动程序,但保持浏览器打开.我意识到之后我将不得不手动关闭浏览器,我很好.
到目前为止,我有:
DriverService service = ChromeDriverService.CreateDefaultService();
ChromeOptions options = new ChromeOptions();
options.AddAdditionalCapability("chrome.detach",true);
m_driver = new ChromeDriver(service, options, TimeSpan.FromMilliseconds(1000));
[m_driver does stuff like navigate page, double click stuff, etc]
[last line: try to close driver but not browser]
Run Code Online (Sandbox Code Playgroud)
我已经尝试了以下所有内容作为最后一行
m_driver.Dispose(); // closes both browser and driver
m_driver.Close(); //closes just the browser and not the driver
m_driver.Quit(); // closes both browser and driver
service.Dispose(); // closes both browser and driver
Run Code Online (Sandbox Code Playgroud)
有任何想法吗?