2013-03-14 124 views
5

我是新来硒网络驱动器以及栅2WebDriverException:错误转发新的会话找不到:{平台= WINDOWS,browserName = FIREFOX,版本= 3.6}

我试图运行测试如此,但它给了我主要的例外 “在线程异常‘’org.openqa.selenium.WebDriverException:错误转发新的会话找不到:{平台= WINDOWS,browserName = FIREFOX,版本= 3.6}”

我使用命令启动了一个节点和集线器 java -jar selenium-server-standalone-2.29.0.jar -role集线器

java -jar selenium-server-standalone-2.29.0.jar -role node -hub%grid register%

这两个命令都正常工作。

我不知道何时何地,我需要使用命令行 -browser browserName =火狐,版本= 3.6,MAXINSTANCES = 5,平台= WINDOWS

(试图从电网配置节点2官方

是不是因为任何帮助,这将是非常赞赏

这里是我的代码:?

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"); 

} 
} 

回答

2

对于注册节点,具有特定browserr配置u必须使用从命令提示以下线:

Java的罐子硒 - 服务器 - 独立-2.32.0.jar -role节点-hub http://xxx.xxx.xxx.xxx:4444/grid/register -browser browserName =火狐

与实际IP地址替换XXX

1

我认为这是由于capability.setBrowserName(“火狐”);

应该是capability.setBrowserName(“firefox”);

希望有所帮助。

0

我也面临同样的问题。 它得到解决,问题是端口4444.它被阻止。 因此,为我的系统创建一个全球IP,并允许端口4444为我工作。

0

如果您运行并行测试。增加线程数并增加集线器内存

cat /proc/sys/kernel/threads-max 
echo 100000 > /proc/sys/kernel/threads-max 
0

它可能正是它所说的:集线器/硒找不到所需功能的匹配。

我有这个问题,该错误的得到的是(格式化后):

java.lang.RuntimeException : org.openqa.selenium.WebDriverException : Error forwarding the new session cannot find : Capabilities[{ 
     proxy = { 
      proxyAutoconfigUrl = null, 
      socksUsername = null, 
      socksPassword = null, 
      autodetect = false, 
      httpProxy = xxxxxxxxxxxx.com : 8080, 
      proxyType = MANUAL, 
      noProxy = xxxxxxxxxxxxx.net, 
      ftpProxy = null, 
      hCode = 1273131486, 
      socksProxy = null, 
      class = org.openqa.selenium.Proxy, 
      sslProxy = xxxxxxxxxxxxxx.com : 8080 
     }, 
     loggingPrefs = org.openqa.selenium.logging.LoggingPreferences @ 3564e4e9, 
     browserName = MicrosoftEdge, 
     type = regular, 
     version = , 
     platform = ANY 
    } 
] 

原来,我的同事已经增加了一个新的参数功能(“类型”),和我没有更新我的.json文件来配置我的Selenium节点。

相关问题