【发布时间】: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>
【问题讨论】:
-
您使用的是哪种语言装订艺术?使用您的代码块更新有关如何实现浏览器功能的问题。