7

Selenium Web ドライバーと Grid 2 は初めてです。

テスト ケースを実行しようとしていますが、例外が発生します

スレッド "main" org.openqa.selenium.WebDriverException での例外: 新しいセッションの転送エラーが見つかりません: {platform=WINDOWS, browserName=FIREFOX, version=3.6}

コマンドを使用してノードとハブを開始しました

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

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

}
}
4

6 に答える 6

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
    }
]

同僚が機能 (「タイプ」) に新しいパラメーターを追加したことが判明しましたが、Selenium ノードを構成する .json ファイルを更新していませんでした。

于 2016-10-14T14:50:42.150 に答える
0

私も同じ問題に直面しました。解決しました。問題はポート 4444 にあり、ブロックされていました。したがって、システムのグローバル IP を作成し、ポート 4444 を許可するとうまくいきました。

于 2014-01-28T05:41:14.843 に答える
-1

並列テストを実行する場合。スレッド数を増やしてハブ メモリを増やす

cat /proc/sys/kernel/threads-max
echo 100000 > /proc/sys/kernel/threads-max
于 2015-11-18T13:03:39.967 に答える