0

Selenium Grid を使用して Web ページのテストを行っています。セレン ハブ:

java -jar selenium-server-standalone-2.25.0.jar -role hub

セレンノード:

java -jar selenium-server-standalone-2.25.0.jar -role node  -hub http://192.168.55.209:4444/grid/register browser browserName=firefox,platform=WINDOWS

そして、ノードはハブに正常に登録されました。次のように使用したJavaコードの場合:

@Before
public void setUp() throws Exception,MalformedURLException, IOException {
    DesiredCapabilities browser = DesiredCapabilities.firefox();
    browser.setPlatform(Platform.WINDOWS);
    try{
    driver=new RemoteWebDriver(new URL("http://192.168.55.209:4444/wd/hub"),browser);
                } finally{
                    if (driver != null) {
                                 driver.quit();
                    }
                }

しかし、コンパイラが到達すると:

driver.get(url);

次のようなエラーメッセージが表示されますが、問題は見つかりませんでした。

org.openqa.selenium.remote.UnreachableBrowserException: Error communicating with the remote browser. It may have died.
Build info: version: '2.24.1', revision: '17205', time: '2012-06-19 16:53:24'
System info: os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.7.0_07'
Driver info: driver.version: RemoteWebDriver
    at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:467)
    at org.openqa.selenium.remote.RemoteWebDriver.get(RemoteWebDriver.java:216)
    at libraries.Globals.login(Globals.java:242)
    at simple.SimplePolicy.simplePolicy(SimplePolicy.java:31)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:45)
    at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
    at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:42)
    at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
    at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
    at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:30)
    at org.junit.rules.TestWatcher$1.evaluate(TestWatcher.java:47)
    at org.junit.rules.RunRules.evaluate(RunRules.java:18)
    at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:263)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:68)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:47)
    at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231)
    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60)
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229)
    at org.junit.runners.ParentRunner.access$000(ParentRunner.java:50)
    at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:300)
    at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
    at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
Caused by: org.openqa.selenium.WebDriverException: Session ID may not be null
Build info: version: '2.24.1', revision: '17205', time: '2012-06-19 16:53:24'
System info: os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.7.0_07'
Driver info: driver.version: RemoteWebDriver
    at org.openqa.selenium.remote.HttpCommandExecutor$CommandInfo.get(HttpCommandExecutor.java:560)
    at org.openqa.selenium.remote.HttpCommandExecutor$CommandInfo.getMethod(HttpCommandExecutor.java:544)
    at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:281)
    at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:446)
    ... 30 more
4

1 に答える 1

0

あなたの設定には がありますが、前browser browserName=firefoxの記号 " " を忘れたので、 : である必要があります。これは問題になる可能性があります。webdriver はエラーを表示しませんが、その特定の " " を実際の Firefox ブラウザーに関連付けることはできません。-browser-browser browserName=firefoxfirefox

于 2012-11-07T08:55:17.747 に答える