gpt4 book ai didi

java - com.google.gson.stream.MalformedJsonException : Use JsonReader. setLenient(true) 在将 Selenium 网格节点注册到集线器时接受格式错误的 JSON

转载 作者:塔克拉玛干 更新时间:2023-11-02 19:49:57 28 4
gpt4 key购买 nike

我安装了 selenium-server-standalone-3.4.0.jar 并在我的机器 A 上运行以下命令(作为 hube):

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

运行成功

然后,在我的机器 B(作为节点)上运行以下命令:

java -jar selenium-server-standalone-3.4.0.jar -role node -hub http://192.168.1.27:4444/grid/register

生成了以下日志。如您所见,首先它已注册,然后表明它未注册。怎么可能?

> 11:35:29.561 INFO - Selenium build info: version: '3.4.0', revision: 'unknown'
> 11:35:29.562 INFO - Launching a Selenium Grid node
> 11:35:30.353 WARN - error getting the parameters from the hub. The node may end up with wrong timeouts.com.google.gson.stream.MalformedJsonException: Use JsonReader.setLenient(true) to accept malformed JSON at line 1 column 12 path $
> 2017-07-23 11:35:30.417:INFO::main: Logging initialized @1343ms to org.seleniumhq.jetty9.util.log.StdErrLog
> 11:35:30.568 INFO - Driver provider org.openqa.selenium.ie.InternetExplorerDriver registration is skipped:
registration capabilities Capabilities [{ensureCleanSession=true, browserName=internet explorer, version=, platform=WINDOWS}] does not match the current platform LINUX
> 11:35:30.568 INFO - Driver provider org.openqa.selenium.edge.EdgeDriver registration is skipped:
registration capabilities Capabilities [{browserName=MicrosoftEdge, version=, platform=WINDOWS}] does not match the current platform LINUX
> 11:35:30.572 INFO - Driver class not found: com.opera.core.systems.OperaDriver
> 11:35:30.572 INFO - Driver provider com.opera.core.systems.OperaDriver registration is skipped:
Unable to create new instances on this machine.
> 11:35:30.573 INFO - Driver class not found: com.opera.core.systems.OperaDriver
> 11:35:30.575 INFO - Driver provider com.opera.core.systems.OperaDriver is not registered
> 11:35:30.585 INFO - Driver provider org.openqa.selenium.safari.SafariDriver registration is skipped:
registration capabilities Capabilities [{browserName=safari, version=, platform=MAC}] does not match the current platform LINUX
> 2017-07-23 11:35:30.729:INFO:osjs.Server:main: jetty-9.4.3.v20170317
> 2017-07-23 11:35:30.828:INFO:osjsh.ContextHandler:main: Started o.s.j.s.ServletContextHandler@70be0a2b{/,null,AVAILABLE}
> 2017-07-23 11:35:30.899:INFO:osjs.AbstractConnector:main: Started ServerConnector@29176cc1{HTTP/1.1,[http/1.1]}{0.0.0.0:5555}
> 2017-07-23 11:35:30.900:INFO:osjs.Server:main: Started @1827ms

> 11:35:30.900 INFO - Selenium Grid node is up and ready to register to the hub

> 11:35:31.017 INFO - Starting auto registration thread. Will try to register every 5000 ms.

> 11:35:31.017 INFO - Registering the node to the hub: http://192.168.1.27:4444/grid/register

> 11:35:31.062 INFO - The node is registered to the hub and ready to use

> 11:35:36.095 INFO - Couldn't register this node: The hub is down or not responding: com.google.gson.stream.MalformedJsonException: Use JsonReader.setLenient(true) to accept malformed JSON at line 1 column 12 path $

> 11:35:41.123 INFO - Couldn't register this node: The hub is down or not responding: com.google.gson.stream.MalformedJsonException: Use JsonReader.setLenient(true) to accept malformed JSON at line 1 column 12 path $

> 11:35:46.135 INFO - Couldn't register this node: The hub is down or not responding: com.google.gson.stream.MalformedJsonException: Use JsonReader.setLenient(true) to accept malformed JSON at line 1 column 12 path $

最佳答案

这是您问题的答案:

假设您的要求是运行 Selenium Grid Hub 默认端口 4444 Selenium Grid Node 默认端口 5555我们需要按如下方式配置和启动它们:

  1. 启动 Selenium Grid Hub:

    java -jar selenium-server-standalone-3.4.0.jar -role hub
  2. 以下日志确认您的 Selenium Grid Hub 正在正常运行:

    2017-07-24 15:31:46.139:INFO:osjs.Server:main: Started @2757ms
    15:31:46.140 INFO - Nodes should register to http://192.168.0.107:4444/grid/register/
    15:31:46.140 INFO - Selenium Grid hub is up and running
  3. 通过 URL 访问 Selenium Grid 控制台:

    http://localhost:4444/grid/console
  4. 启动 Selenium 网格节点:

    java -jar selenium-server-standalone-3.4.0.jar -role node -hub http://<IP_GRID_HUB>:4444/grid/register

    我用过localhost所以我用了:

    java -jar selenium-server-standalone-3.4.0.jar -role node -hub http://localhost:4444/grid/register
  5. 以下日志确认您的 Selenium 网格节点正在正常运行:

    15:35:44.939 INFO - Selenium Grid node is up and ready to register to the hub
    15:35:44.958 INFO - Starting auto registration thread. Will try to register every 5000 ms.
    15:35:44.958 INFO - Registering the node to the hub: http://localhost:4444/grid/register
    15:35:45.231 INFO - The node is registered to the hub and ready to use
  6. 通过控制台 URL 访问 Selenium Grid 控制台以查看已注册的节点:

    http://localhost:4444/grid/console

如果这回答了您的问题,请告诉我。

关于java - com.google.gson.stream.MalformedJsonException : Use JsonReader. setLenient(true) 在将 Selenium 网格节点注册到集线器时接受格式错误的 JSON,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45263543/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com