首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >线程“主”org.openqa.selenium.WebDriverException中的异常:无法访问chrome

线程“主”org.openqa.selenium.WebDriverException中的异常:无法访问chrome
EN

Stack Overflow用户
提问于 2017-05-30 07:40:24
回答 3查看 3K关注 0票数 0

我正在尝试使用selenium (2.53.1)启动Chrome(版本58.0.3029.110 (64位))

代码语言:javascript
复制
 <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>`

代码::

代码语言:javascript
复制
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),只允许本地连接。线程"main“org.openqa.selenium.WebDriverException中的异常:无法访问的chrome (驱动程序信息: chromedriver=2.29.461591 (62ebf0987772160f391d75e589dc567915b233),platform=Windows NT 6.1.7601 SP1 x86_64) (警告:服务器没有提供任何堆栈跟踪信息)命令持续时间或超时时间: 62.38秒构建信息:版本:'2.53.1',修订版:‘a36b8b1cd5757287168e54b830adce9b0158d’,时间:‘2016-06-3019:26:09’

请帮我处理这个。我不知道是什么问题。

EN

回答 3

Stack Overflow用户

发布于 2017-05-30 07:58:38

看起来你使用了错误版本的Chrome驱动程序。

因为您的Chrome browser版本是58.0.3029.110,所以必须使用ChromeDriver 2.29,它可以从这里下载。

票数 0
EN

Stack Overflow用户

发布于 2017-05-30 08:59:08

不能确定Selenium2.53是否能与最新的ChromeDriver一起工作。如果您可以尝试使用最新版本的Selenium (v3.4),那就太好了。

票数 0
EN

Stack Overflow用户

发布于 2017-05-30 10:01:28

把这个给我

代码语言:javascript
复制
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");
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/44256318

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档