我希望使用Selenium Web Driver在VS 2010 C#中打开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]
我已经尝试了以下所有内容作为最后一行:
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
有什么想法吗?