0

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

我们认为我们需要做的一件事是更改默认超时。我已阅读selenium 文档,您可以使用共享功能“超时”来执行此操作。我们还知道您可以在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>
4

1 回答 1

0

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

于 2022-02-18T13:28:56.963 回答