WebDriverException:转发新会话时出错:找不到:{platform = WINDOWS,browserName = FIREFOX,version = 3.6} [英] WebDriverException: Error forwarding the new session cannot find : {platform=WINDOWS, browserName=FIREFOX, version=3.6}
问题描述
我是Selenium Web驱动程序以及Grid 2的新手。
I am new to Selenium Web driver as well as Grid 2.
我正在尝试运行测试用例,但它给了我一个异常
I am trying to run a test case but it gives me an exception
线程main中的异常org.openqa.selenium.WebDriverException:转发新会话时出错找不到:{platform = WINDOWS,browserName = FIREFOX,version = 3.6}
Exception in thread "main" org.openqa.selenium.WebDriverException: Error forwarding the new session cannot find : {platform=WINDOWS, browserName=FIREFOX, version=3.6}
我已经使用命令启动了一个节点和集线器
I have started a node and hub using command
java -jar selenium-server-standalone-2.29.0.jar -role hub
java -jar selenium-server-standalone-2.29.0.jar -role node -hub %grid register%
这两个命令都正常。
我不确定我何时何地需要使用命令行
-browser browserName = firefox,version = 3.6,maxInstances = 5,platform = WINDOWS
I am not sure when and where I need to use the command line -browser browserName=firefox,version=3.6,maxInstances=5,platform=WINDOWS
(试图从网格2官方页面配置节点
(Tried to configure the node from Grid 2 official page
这是因为这个吗?
这是我的代码:
package test;
import java.net.URL;
import java.net.MalformedURLException;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.htmlunit.HtmlUnitDriver;
import org.openqa.selenium.WebDriverBackedSelenium;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.openqa.selenium.remote.RemoteWebDriver;
public class Test {
public static void main(String[] args) throws MalformedURLException {
DesiredCapabilities capability = DesiredCapabilities.firefox();
capability.setBrowserName("FIREFOX");
capability.setPlatform(org.openqa.selenium.Platform.WINDOWS);
capability.setVersion("3.6");
// capability.setCapability("");
WebDriver driver = new RemoteWebDriver(new URL("http://localhost:4444/wd/hub"), capability);
//WebDriver driver = new FirefoxDriver();
driver.get("http://www.google.com");
}
}
推荐答案
对于注册节点,使用特定的浏览器配置,您必须在命令提示符下使用以下行:
For Registering Node, with a specific browserr configuration u have to use the below line from command prompt:
java -jar selenium-server-standalone-2.32.0 .jar -role node -hub http://xxx.xxx.xxx.xxx:4444/ grid / register -browser browserName = firefox
java -jar selenium-server-standalone-2.32.0.jar -role node -hub http://xxx.xxx.xxx.xxx:4444/grid/register -browser browserName=firefox
将xxx替换为实际的ip地址
Replace the xxx with the actual ip address
这篇关于WebDriverException:转发新会话时出错:找不到:{platform = WINDOWS,browserName = FIREFOX,version = 3.6}的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!