Selenium スタンドアロン サーバーのインスタンス ノードが 500 エラー応答を返します com.google.gson.JsonPrimitive.isPrimitiveOrString で発生した NullPointerException
このエラーをトラブルシューティングするためのヒントは高く評価されています。
Selenium Server Hub とノードを起動します ノードがサーバー コンソールに表示されていることを確認します。
ソフトウェアバージョン:
- アパッチ Maven 3.5.0
- セレン-サーバー-スタンドアロン-3.5.0
- ChromeDriver 2.31 - geckodriver-v0.18.0-win64
- Chrome v 60.0.3112.101 (64 ビット)
- Firefox 55.0.2 (64 ビット)
- Java 1.8.0_92 (64 ビット)
サーバー起動コマンド:
java -jar "selenium-server-standalone-3.5.0.jar" -role hub
java -Dwebdriver.gecko.driver="C:/selenium/geckodriver.exe" -jar "selenium-server-standalone-3.5.0.jar" -role node -hub http://localhost:4444/grid/register
Maven POM:
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>3.4.0</version>
Java クラス (インポートを除く):
public class GoogleSearchTest extends TestCase {
public void testApp() throws MalformedURLException {
DesiredCapabilities cap = DesiredCapabilities.firefox();
cap.setPlatform(Platform.ANY);
driver = new RemoteWebDriver(new URL("http://localhost:4444/wd/hub"), cap);
driver.navigate().to("http://www.google.com/");
} }
エラー スタック:
Problem accessing /wd/hub/session. Reason:
Caused by: java.lang.NullPointerException ** at com.google.gson.JsonPrimitive.isPrimitiveOrString(JsonPrimitive.java:278)
at com.google.gson.JsonPrimitive.setValue(JsonPrimitive.java:101)
at com.google.gson.JsonPrimitive.<init>(JsonPrimitive.java:65)
at org.openqa.selenium.remote.server.ExceptionHandler.lambda$execute$0(ExceptionHandler.java:82)
at java.util.stream.ReferencePipeline$3$1.accept(Unknown Source)
at java.util.Spliterators$ArraySpliterator.forEachRemaining(Unknown Source)
at java.util.stream.AbstractPipeline.copyInto(Unknown Source)
at java.util.stream.AbstractPipeline.wrapAndCopyInto(Unknown Source)
at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(Unknown Source)
at java.util.stream.AbstractPipeline.evaluate(Unknown Source)
at java.util.stream.ReferencePipeline.collect(Unknown Source)
このエラーは、自動化テストの非常に早い段階で発生するようです。私がまだ答えを持っていない質問: 送信される JSON ペイロードは何ですか? 構成する必要がある追加の機能はありますか?
類似の投稿