当在selenium上启动chromedriver浏览器并尝试导航到某个页面时,浏览器没有响应并且没有写入chromedriver log

时间:2016-12-16 07:10:15

标签: c# selenium-webdriver selenium-chromedriver

我在c#上使用selenium web驱动程序版本3.0.0,以及chromedriver 2.8(最新版本)。 当尝试启动浏览器并导航到某个页面时,浏览器启动但没有响应,也没有写入chrome日志。 我的代码是:

var optn = new ChromeOptions();
optn.AddArgument("--verbose");
optn.AddArgument("test-type");
optn.AddArgument("disable-extensions");
optn.AddArgument("--no-sandbox");
var service = ChromeDriverService.CreateDefaultService(chromeDriverPath);
service.LogPath = @"C:\temp\chromedriver.log";
service.EnableVerboseLogging = true;
var driver = new ChromeDriver(service, optn);
driver.Navigate().GoToUrl("https://www.google.co.in/?gfe_rd=cr&ei=aWh0U7WHEJGAuASTuYHIAQ");

2 个答案:

答案 0 :(得分:1)

试试这个:

                String chromeDriverPath = @"C:\Users\Shani\Documents\visual studio 2013\Projects\StudentsReporter\Drivers\"; 
                ChromeOptions options = new ChromeOptions(); 
                options.AddArgument("disable-extensions"); 
                options.AddArgument("--verbose"); 
                options.AddArgument("test-type"); 
                options.AddArgument("start-maximized");
                driver = new ChromeDriver(chromeDriverPath, options);
                driver.Navigate().GoToUrl("https://www.google.com/");

答案 1 :(得分:0)

String chromeDriverPath = @" C:\ Users \ Shani \ Documents \ visual studio 2013 \ Projects \ StudentsReporter \ Drivers \&#34 ;; ChromeOptions选项=新的ChromeOptions(); options.AddArgument(" DISABLEEXTENSIONS&#34); options.AddArgument(" - 冗长&#34); options.AddArgument("测试型&#34); options.AddArgument("启动最大化&#34); ChromeDriver驱动程序=新的C​​hromeDriver(chromeDriverPath,选项); 。driver.Navigate()GoToUrl(" google.com&#34);