使用远程"chromedriver.exe"文件设置Chrome WebDriver [英] Setup Chrome WebDriver with remote 'chromedriver.exe' file

查看:268
本文介绍了使用远程"chromedriver.exe"文件设置Chrome WebDriver的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的系统中安装了chrome.我正在使用Selenium在chrome上运行一些测试.

I have chrome installed in my system. I'm using Selenium to run some tests on chrome.

我已将Chromedriver.exe下载到MyDocuments.我已经使用System.setProperty()设置了"webdriver.chrome.driver",并启动了ChromeDriver().效果很好.

I have downloaded the Chromedriver.exe to MyDocuments. I have set the 'webdriver.chrome.driver' using System.setProperty() and started ChromeDriver(). It works fine.

System.setProperty("webdriver.chrome.driver", "C:\\MyDocuments\\chromedriver.exe");
driver=new ChromeDriver();

现在,我正在尝试将Chromedriver.exe放入远程计算机"https://remotemachine/chromedriver.exe"中.当我设置System属性并启动ChromeDriver()时,出现了一个异常,Selenium在一个奇怪的路径中搜索chrome:

Now, I'm trying to put Chromedriver.exe in a remote machine 'https://remotemachine/chromedriver.exe'. When I set the System property and start ChromeDriver(), I'm getting an exception, where Selenium is searching for chrome in a strange path:

webdriver.chrome.driver定义的chromedriver可执行文件没有 存在于C:\ Users .. \ Appdata \ Local \ Google Chrome \ Application ... \ https://remotemachine/chromedriver.exe

The webdriver.chrome.driver defined chromedriver executable does not exist in C:\Users..\Appdata\Local\Google Chrome\Application...\https://remotemachine/chromedriver.exe

Selenium为什么通过将系统属性附加到C驱动器中的某个位置来搜索chromedriver.exe?

Why is Selenium searching for the chromedriver.exe by appending the system property to some location in C drive ?

如何使用远程chromedriver.exe文件从Selenium启动Chrome?

How to launch Chrome from Selenium using a remote chromedriver.exe file ?

与以上无关,但:

是否还可以使用Java/Selenium查找默认的浏览器二进制路径?

Is it also possible to find the default browser binary path using Java/Selenium ?

推荐答案

它期望chrome在Windows中位于该位置

It expects chrome to be in this location in windows

%HOMEPATH%\ AppData \ Local \ Google \ Chrome \ Application \ chrome.exe

%HOMEPATH%\AppData\Local\Google\Chrome\Application\chrome.exe

对于远程,它必须位于路径中,否则-Dwebdriver.chrome.driver值应指向本地chromedriver.exe位置.

For remote it has to be either in path or the -Dwebdriver.chrome.driver value should be pointing to a local chromedriver.exe location.

本地,与运行所在位置的本地相同.

Local as in local to the place it is being run.

以下是设置链接: http://code.google.com/p/selenium/wiki/RemoteWebDriver http://code.google.com/p/selenium/wiki/ChromeDriver

Here is the link for setup: http://code.google.com/p/selenium/wiki/RemoteWebDriver http://code.google.com/p/selenium/wiki/ChromeDriver

这篇关于使用远程"chromedriver.exe"文件设置Chrome WebDriver的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆