在哪里可以找到 Se 2 网格集线器配置 json 的架构或文档?

发布于 2024-12-04 15:34:14 字数 524 浏览 2 评论 0原文

我有一个 Se 2 网格集线器正在运行。在哪里可以找到有关 -hubConfig 参数的效果和架构的文档?目前我的网格集线器显示:“使用 grid2 配置更新:未指定集线器配置文件。要指定一个,请使用 -hubConfig XXX.json,其中 XXX.json 是集线器配置文件”。 我可以使用没有配置此集线器。

我在博客和问题中找到了示例,但没有明确的文档。

博客: http://opensourcetester.co.uk/2011/07/ 06/selenium-grid-2/

问题:http://code.google.com/p/selenium/issues/detail?id=2399

I have a Se 2 grid hub running. Where can I find documentation for the effects and schema of the -hubConfig parameter? Currently my grid hub shows: "updated with grid2 config : No hub config file specified. To specify one, use -hubConfig XXX.json where XXX.json is a hub config file". I can use the hub without this configured.

I have found examples in blogs and issues, but no clear documentation.

blogs: http://opensourcetester.co.uk/2011/07/06/selenium-grid-2/

issues: http://code.google.com/p/selenium/issues/detail?id=2399

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

不甘平庸 2024-12-11 15:34:14

我发现一个很好的起点是查看 Selenium Grid 2 代码库中的示例

下面是一个示例 hub 文件(假设我们将 json 文件命名为 hub.json):

使用:java -jar selenium-server-standalone-2.6.0.jar -role hub -hubConfig hub.json

{
  "host": null,
  "port": 4444,
  "newSessionWaitTimeout": -1,
  "servlets" : [],
  "prioritizer": null,
  "capabilityMatcher": "org.openqa.grid.internal.utils.DefaultCapabilityMatcher",
  "throwOnCapabilityNotPresent": true,
  "nodePolling": 5000,

  "cleanUpCycle": 5000,
  "timeout": 300000,
  "maxSession": 5
}

此处是一个示例节点文件(假设该文件名为 rc.json):

使用: java -jar selenium-server-standalone-2.6.0.jar -role rc -nodeConfig rc.json

{
  "capabilities":
      [
        {
          "browserName": "firefox",
          "maxInstances": 5
        },
        {
          "browserName": "chrome",
          "maxInstances": 5
        },
        {
          "browserName": "internet explorer",
          "maxInstances": 1
        }
      ],
    "configuration":
        {
        "nodeTimeout":120,
        "port":5555,

        "hubPort":4444,
        "hubHost":"localhost",

        "nodePolling":2000,

        "registerCycle":10000,
        "register":true,
        "cleanUpCycle":2000,
        "timeout":30000,
        "maxSession":5,
        }
}

您可以如果需要不同的配置,则 create 使用角色“wd”的类似格式。

I've found a good starting point is looking at examples in the Selenium Grid 2 code base.

Here is a sample hub file (assume we name the json file hub.json):

Use: java -jar selenium-server-standalone-2.6.0.jar -role hub -hubConfig hub.json

{
  "host": null,
  "port": 4444,
  "newSessionWaitTimeout": -1,
  "servlets" : [],
  "prioritizer": null,
  "capabilityMatcher": "org.openqa.grid.internal.utils.DefaultCapabilityMatcher",
  "throwOnCapabilityNotPresent": true,
  "nodePolling": 5000,

  "cleanUpCycle": 5000,
  "timeout": 300000,
  "maxSession": 5
}

here is a sample node file (assume the file is named rc.json):

Use: java -jar selenium-server-standalone-2.6.0.jar -role rc -nodeConfig rc.json

{
  "capabilities":
      [
        {
          "browserName": "firefox",
          "maxInstances": 5
        },
        {
          "browserName": "chrome",
          "maxInstances": 5
        },
        {
          "browserName": "internet explorer",
          "maxInstances": 1
        }
      ],
    "configuration":
        {
        "nodeTimeout":120,
        "port":5555,

        "hubPort":4444,
        "hubHost":"localhost",

        "nodePolling":2000,

        "registerCycle":10000,
        "register":true,
        "cleanUpCycle":2000,
        "timeout":30000,
        "maxSession":5,
        }
}

You can create use the similar format for role "wd" if it's required to have a different configuration.

晌融 2024-12-11 15:34:14

javadoc和各种 来源 代码< /a> 文件在一定程度上有帮助,但 wiki 不是很有帮助很有帮助,并且在您深入研究代码之前,各种配置示例似乎不一致。例如,DefaultHub.json 指定 "timeout" : 300000 这导致人们假设超时以毫秒为单位,但如果您查看命令行示例,您会发现超时是以秒为单位指定的。如果您查看代码,您会发现,事实上,JSON 配置方案确实采用以毫秒为单位的超时(以及所有其他时间值),但所有其他配置方案都采用以秒为单位的超时(以及其他一些时间值)。

我发现的关于集线器和节点选项的最易读和最简洁的文档位于 GridParameters.properties (似乎不再存在),但请记住所有时间值JSON 配置文件中的单位为 ms

role = <hub|node> (default is no grid, just run an RC/webdriver server). When launching a node, the parameters will be forwarded to the server on the node, so you can use something like -role node -trustAllSSLCertificates.  In that case, the SeleniumServer will be launch with the trustallSSLCertificates option.

# hub config
host = (hub & node)  <IP | hostname> : usually not needed and determined automatically. For exotic network configuration, network with VPN, specifying the host might be necessary.
port = (hub & node) <xxxx> : the port the remote/hub will listen on. Default to 4444.


throwOnCapabilityNotPresent = (hub) <true | false> default to true. If true, the hub will reject test requests right away if no proxy is currently registered that can host that capability.Set it to false to have the request queued until a node supporting the capability is added to the grid.
newSessionWaitTimeout = (hub) <XXXX>. Default to no timeout ( -1 ) the time in ms after which a new test waiting for a node to become available will time out.When that happens, the test will throw an exception before starting a browser.

capabilityMatcher = (hub) a class implementing the CapabilityMatcher interface. Defaults to org.openqa.grid.internal.utils.DefaultCapabilityMatcher. Specify the logic the hub will follow to define if a request can be assigned to a node.Change this class if you want to have the matching process use regular expression instead of exact match for the version of the browser for instance. All the nodes of a grid instance will use the same matcher, defined by the registry.
prioritizer = (hub) a class implementing the Prioritizer interface. Default to null ( no priority = FIFO ).Specify a custom prioritizer if you need the grid to process the tests from the CI, or the IE tests first for instance.
servlets = (hub & node) <com.mycompany.MyServlet,com.mycompany.MyServlet2> to register a new servlet on the hub/node. The servlet will accessible under the path  /grid/admin/MyServlet /grid/admin/MyServlet2


grid1Yml = (hub) a YML file following grid1 format.
hubConfig = (hub) a JSON file following grid2 format that defines the hub properties.
nodeConfig = (node) a JSON file following grid2 format that defines the node properties.


# config that will be inherited by the proxy and used for the node management.
cleanupCycle = (node) <XXXX> in ms. How often a proxy will check for timed out thread.
timeout = (node) <XXXX>  the timeout in seconds before the hub automatically ends a test that hasn't had any activity in the last X seconds. The browser will be released for another test to use. This typically takes care of the client crashes.
browserTimeout= (hub/node) The timeout in seconds a browser can hang
hub = (node) <http://localhost:4444/grid/register> : the url that will be used to post the registration request. This option takes precedence over -hubHost and -hubPort options.
hubHost = (node) <IP | hostname> : the host address of a hub the registration request should be sent to. Default to localhost. Option -hub takes precedence over this option.
hubPort = (node) <xxxx> : the port listened by a hub the registration request should be sent to. Default to 4444. Option -hub takes precedence over this option.
proxy = (node) the class that will be used to represent the node. By default org.openqa.grid.selenium.proxy.DefaultRemoteProxy.
maxSession = (node) max number of tests that can run at the same time on the node, independently of the browser used.
registerCycle = (node) how often in ms the node will try to register itself again.Allow to restart the hub without having to restart the nodes.
nodePolling = (node) in ms. Interval between alive checks of node how often the hub checks if the node is still alive.
unregisterIfStillDownAfter = (node) in ms. If the node remains down for more than unregisterIfStillDownAfter millisec, it will disappear from the hub.Default is 1min. 
downPollingLimit = (node) node is marked as down after downPollingLimit alive checks.
nodeStatusCheckTimeout = (node) in ms. Connection and socket timeout which is used for node alive check.

The javadocs and various source code files are helpful to a certain extent but the wiki is not very helpful and the various configuration examples seem inconsistent until you dig into the code. For example, DefaultHub.json specifies "timeout" : 300000 which leads one to assume timeout is in ms but if you look at command-line examples you'll see that timeout is specified in seconds. If you look at the code you'll see that, indeed, the JSON configuration scheme does take timeout (and all other time values) in ms but all other configuration schemes take the timeout (and some other time values) in seconds.

The most readable and concise documentation I've found for the hub and node options is in an old copy of GridParameters.properties (which no longer seems to exist), but keep in mind that all time values in a JSON configuration file are in ms:

role = <hub|node> (default is no grid, just run an RC/webdriver server). When launching a node, the parameters will be forwarded to the server on the node, so you can use something like -role node -trustAllSSLCertificates.  In that case, the SeleniumServer will be launch with the trustallSSLCertificates option.

# hub config
host = (hub & node)  <IP | hostname> : usually not needed and determined automatically. For exotic network configuration, network with VPN, specifying the host might be necessary.
port = (hub & node) <xxxx> : the port the remote/hub will listen on. Default to 4444.


throwOnCapabilityNotPresent = (hub) <true | false> default to true. If true, the hub will reject test requests right away if no proxy is currently registered that can host that capability.Set it to false to have the request queued until a node supporting the capability is added to the grid.
newSessionWaitTimeout = (hub) <XXXX>. Default to no timeout ( -1 ) the time in ms after which a new test waiting for a node to become available will time out.When that happens, the test will throw an exception before starting a browser.

capabilityMatcher = (hub) a class implementing the CapabilityMatcher interface. Defaults to org.openqa.grid.internal.utils.DefaultCapabilityMatcher. Specify the logic the hub will follow to define if a request can be assigned to a node.Change this class if you want to have the matching process use regular expression instead of exact match for the version of the browser for instance. All the nodes of a grid instance will use the same matcher, defined by the registry.
prioritizer = (hub) a class implementing the Prioritizer interface. Default to null ( no priority = FIFO ).Specify a custom prioritizer if you need the grid to process the tests from the CI, or the IE tests first for instance.
servlets = (hub & node) <com.mycompany.MyServlet,com.mycompany.MyServlet2> to register a new servlet on the hub/node. The servlet will accessible under the path  /grid/admin/MyServlet /grid/admin/MyServlet2


grid1Yml = (hub) a YML file following grid1 format.
hubConfig = (hub) a JSON file following grid2 format that defines the hub properties.
nodeConfig = (node) a JSON file following grid2 format that defines the node properties.


# config that will be inherited by the proxy and used for the node management.
cleanupCycle = (node) <XXXX> in ms. How often a proxy will check for timed out thread.
timeout = (node) <XXXX>  the timeout in seconds before the hub automatically ends a test that hasn't had any activity in the last X seconds. The browser will be released for another test to use. This typically takes care of the client crashes.
browserTimeout= (hub/node) The timeout in seconds a browser can hang
hub = (node) <http://localhost:4444/grid/register> : the url that will be used to post the registration request. This option takes precedence over -hubHost and -hubPort options.
hubHost = (node) <IP | hostname> : the host address of a hub the registration request should be sent to. Default to localhost. Option -hub takes precedence over this option.
hubPort = (node) <xxxx> : the port listened by a hub the registration request should be sent to. Default to 4444. Option -hub takes precedence over this option.
proxy = (node) the class that will be used to represent the node. By default org.openqa.grid.selenium.proxy.DefaultRemoteProxy.
maxSession = (node) max number of tests that can run at the same time on the node, independently of the browser used.
registerCycle = (node) how often in ms the node will try to register itself again.Allow to restart the hub without having to restart the nodes.
nodePolling = (node) in ms. Interval between alive checks of node how often the hub checks if the node is still alive.
unregisterIfStillDownAfter = (node) in ms. If the node remains down for more than unregisterIfStillDownAfter millisec, it will disappear from the hub.Default is 1min. 
downPollingLimit = (node) node is marked as down after downPollingLimit alive checks.
nodeStatusCheckTimeout = (node) in ms. Connection and socket timeout which is used for node alive check.
可是我不能没有你 2024-12-11 15:34:14

维基文档很少,但源代码中有很多有用的注释。 GridHubConfiguration.java 是您应该开始的地方。这是一个示例:

  /**
   * how often in ms each proxy will detect that a session has timed out. All new proxy registering
   * will have that value if they don't specifically mention the parameter.
   */
  private int cleanupCycle;

  /**
   * how long a new session request can stay in the queue without being assigned before being
   * rejected. -1 = forever.
   */
  private int newSessionWaitTimeout;

正在寻找超时配置的含义,在这里找到

  /**
   * how many ms can a session be idle before being considered timed out. Working together with
   * cleanup cycle. Worst case scenario, a session can be idle for timeout + cleanup cycle before the
   * timeout is detected.
   */
  public static final JsonKey CLIENT_TIMEOUT = JsonKey.key("timeout");

The wiki docs are sparse, but there are lots of helpful comments in the source. GridHubConfiguration.java is where you should start. Here's a sample:

  /**
   * how often in ms each proxy will detect that a session has timed out. All new proxy registering
   * will have that value if they don't specifically mention the parameter.
   */
  private int cleanupCycle;

  /**
   * how long a new session request can stay in the queue without being assigned before being
   * rejected. -1 = forever.
   */
  private int newSessionWaitTimeout;

I was looking for what the timeout config meant, found here:

  /**
   * how many ms can a session be idle before being considered timed out. Working together with
   * cleanup cycle. Worst case scenario, a session can be idle for timeout + cleanup cycle before the
   * timeout is detected.
   */
  public static final JsonKey CLIENT_TIMEOUT = JsonKey.key("timeout");
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文