问题描述
我正在尝试使用Selenium Grid启动新的Chrome浏览器,但最终出现以下错误
I'm trying to launch a new Chrome browser using Selenium Grid but ending up with the below error
无法创建新的远程会话.所需功能=功能[{browserName = chrome,版本= 55.0.2,平台= WINDOWS}],所需功能=功能[{}]构建信息:版本:'3.0.1',修订版:'1969d75',时间:'2016-10-18 09:49:13 -0700'系统信息:主机:'PL9710388',ip:'10 .61.249.5',os.name:'Windows 7',os.arch:'amd64',os.version:'6.1',java.version:'1.8.0_111 '驱动程序信息:driver.version:RemoteWebDriver
Unable to create new remote session. desired capabilities = Capabilities [{browserName=chrome, version=55.0.2, platform=WINDOWS}], required capabilities = Capabilities [{}]Build info: version: '3.0.1', revision: '1969d75', time: '2016-10-18 09:49:13 -0700'System info: host: 'PL9710388', ip: '10.61.249.5', os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.8.0_111'Driver info: driver.version: RemoteWebDriver
下面是我启动远程浏览器的代码
Below is my code to launch the Remote browser
java -Dwebdriver.chrome.driver = C:\ chromedriver.exe -jar selenium-server-standalone-3.0.1.jar -role hub
java -Dwebdriver.chrome.driver=C:\chromedriver.exe -jar selenium-server-standalone-3.0.1.jar -role hub
java -Dwebdriver.chrome.driver = C:\ chromedriver.exe -jar selenium-server-standalone-3.0.1.jar -role节点
java -Dwebdriver.chrome.driver=C:\chromedriver.exe -jar selenium-server-standalone-3.0.1.jar -role node
cap = DesiredCapabilities.chrome();
cap.setVersion("55.0.2");
cap.setBrowserName("chrome");
cap.setPlatform(org.openqa.selenium.Platform.WINDOWS);
browser = new RemoteWebDriver(new URL("http://localhost:4444/wd/hub"),cap);
您能帮我解决什么问题吗?
Could you please help me on what is wrong?
推荐答案
确保您的代码能够在系统中找到chromedriver.您可以通过编程方式设置路径,甚至可以从以下下载并保留驱动程序链接
make sure your code is able to find the chromedriver in your system. You can set the path programatically, you can even download and keep your driver from the below link
System.setProperty("webdriver.chrome.driver","/path to/chromedriver.exe");
cap = DesiredCapabilities.chrome();
cap.setPlatform(org.openqa.selenium.Platform.WINDOWS);
browser = new RemoteWebDriver(new URL("http://localhost:4444/wd/hub"),cap);
这篇关于无法创建新的Chrome远程会话的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!