2013-03-14 23 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節點。

相關問題