【问题标题】:Selenium-jupiter - passing timeout in browsers.jsonSelenium-jupiter - 在 browsers.json 中传递超时
【发布时间】:2022-01-21 11:02:46
【问题描述】:

我正在尝试使用 Selenium-Jupiter 编写硒测试。我的团队决定采用@TestTemplate 方法并使用browsers.json

我们认为需要做的一件事是更改默认超时。我已经阅读了the selenium documentation that you can use the shared capability“超时”来这样做。我们还知道您可以在browsers.json 中指定功能。

我的想法已经用完了,我尝试了以下两种方法,但都没有正确设置超时:

{
  "browsers": [
    [
      {
        "type": "edge",
        "version": "latest",
        "capabilities": {
           "timeouts": {"implicit": 10000, "pageLoad": 10000, "script": 30000}
        }
      }
    ]
  ]
}
{
  "browsers": [
    [
      {
        "type": "edge",
        "version": "latest",
        "capabilities": {
           "timeouts": "{\"implicit\": 10000, \"pageLoad\": 10000, \"script\": 30000}"
        }
      }
    ]
  ]
}

前者被忽略并且没有效果。后者在创建 WebDriver 实例时会导致失败。我开始认为这不受支持。 :-(

编辑 1

我正在使用 Java。这是我们pom.xml的一部分:

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>org.junit</groupId>
                <artifactId>junit-bom</artifactId>
                <version>5.8.2</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <dependencies>
        <dependency>
            <groupId>org.seleniumhq.selenium</groupId>
            <artifactId>selenium-java</artifactId>
            <version>4.1.1</version>
        </dependency>

        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>io.github.bonigarcia</groupId>
            <artifactId>selenium-jupiter</artifactId>
            <version>4.0.1</version>
            <scope>test</scope>
        </dependency>
    </dependencies>

【问题讨论】:

  • 您使用的是哪种语言装订艺术?使用您的代码块更新有关如何实现浏览器功能的问题。

标签: selenium selenium-jupiter


【解决方案1】:

目前,Selenium-Jupiter 不支持该功能,抱歉。在 JSON 场景中指定的可能功能是简单的键值字符串(请参阅example)。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2017-05-20
    • 2015-01-07
    • 1970-01-01
    • 1970-01-01
    • 2017-06-24
    • 2018-12-07
    • 1970-01-01
    相关资源
    最近更新 更多