![](/img/trans.png)
[英]org.openqa.selenium.WebDriverException: chrome not reachable
[英]Exception in thread “main” org.openqa.selenium.WebDriverException: chrome not reachable
我正在尝试使用硒(2.53.1)和pom启动Chrome(版本58.0.3029.110(64位))
<dependency> <groupId>org.seleniumhq.selenium</groupId> <artifactId>selenium-server</artifactId> <version>2.53.1</version> <exclusions> <exclusion> <artifactId>snakeyaml</artifactId> <groupId>org.yaml</groupId> </exclusion> </exclusions> </dependency>`
代码::
System.setProperty("webdriver.chrome.driver", System.getProperty("user.dir") + "\\lib\\chromedriver.exe");
System.out.println(System.getProperty("webdriver.chrome.driver"));
DesiredCapabilities desiredCapabilities = DesiredCapabilities.chrome();
ChromeOptions options = new ChromeOptions();
options.addArguments("disable-infobars");
desiredCapabilities.setCapability(ChromeOptions.CAPABILITY, options);
WebDriver driver = new ChromeDriver();
driver.get("http://www.google.com");
我在Eclipse控制台中收到以下异常
D:\\ eclipse \\ QA_Code_Git_Gerrit \\ TA-PAY \\ api-automation \\ lib \\ chromedriver.exe在端口38042上启动ChromeDriver 2.29.461591(62ebf098771772160f391d75e589dc567915b233)仅允许本地连接。 线程“主” org.openqa.selenium.WebDriverException中的异常:无法访问chrome(驱动程序信息:chromedriver = 2.29.461591(62ebf098771772160f391d75e589dc567915b233),platform = Windows NT 6.1.7601 SP1 x86_64)(警告:服务器未提供任何堆栈跟踪信息)命令持续时间或超时:62.38秒构建信息:版本:'2.53.1',修订:'a36b8b1cd5757287168e54b817830adce9b0158d',时间:'2016-06-30 19:26:09'
请帮我解决一下这个。 我不知道这是什么问题。
看来您使用的是错误版本的Chrome驱动程序。
由于您的Chrome browser
版本为58.0.3029.110
,因此您必须使用ChromeDriver 2.29
,可从此处下载
不知道Selenium 2.53是否可以与最新的ChromeDriver一起使用。 如果可以尝试使用最新版本的Selenium(v 3.4),那就更好了。
给这个
System.setProperty("webdriver.chrome.driver", System.getProperty("user.dir") + "\\lib\\chromedriver.exe");
System.out.println(System.getProperty("webdriver.chrome.driver"));
DesiredCapabilities desiredCapabilities = DesiredCapabilities.chrome();
ChromeOptions options = new ChromeOptions();
options.addArguments("disable-infobars");
desiredCapabilities.setCapability(ChromeOptions.CAPABILITY, options);
WebDriver driver = new ChromeDriver(desiredCapabilities);
driver.get("http://www.google.com");
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.