Vaadin Testbench 23 似乎需要 Selenium 4.1.2 但 maven 正在根据 pom 加载 3.141.59

Vaadin Testbench 23 seems to require Selenium 4.1.2 but maven is loading 3.141.59 according to the pom

在我的 pom.xml 我有:

<properties>
    <java.version>18</java.version>
    <vaadin.version>23.0.6</vaadin.version>
</properties>

...

<dependency>
    <groupId>com.vaadin</groupId>
    <artifactId>vaadin-testbench</artifactId>
    <scope>test</scope>
</dependency>

当我 运行 TestBench 我得到以下错误:

WARN com.vaadin.testbench.TestBenchTestCase - This version of TestBench depends on Selenium 
version 4.1.2 but version 3.141.59 was found. Make sure you do not have multiple versions 
of Selenium on the classpath.

然后我 运行 mvn dependency:tree 我能找到的唯一对 Selenium 的引用是:

[INFO] +- com.vaadin:vaadin-testbench:jar:23.0.3:test
[INFO] |  +- com.vaadin:vaadin-testbench-core:jar:8.0.0:test
[INFO] |  |  +- org.seleniumhq.selenium:selenium-remote-driver:jar:3.141.59:test
[INFO] |  |  |  +- org.seleniumhq.selenium:selenium-api:jar:3.141.59:test
[INFO] |  |  |  +- org.apache.commons:commons-exec:jar:1.3:test
[INFO] |  |  |  +- com.google.guava:guava:jar:25.0-jre:test
[INFO] |  |  |  |  +- com.google.code.findbugs:jsr305:jar:1.3.9:compile
[INFO] |  |  |  |  +- org.checkerframework:checker-compat-qual:jar:2.0.0:test
[INFO] |  |  |  |  +- com.google.j2objc:j2objc-annotations:jar:1.1:test
[INFO] |  |  |  |  \- org.codehaus.mojo:animal-sniffer-annotations:jar:1.14:test
[INFO] |  |  |  +- com.squareup.okhttp3:okhttp:jar:3.14.9:test
[INFO] |  |  |  \- com.squareup.okio:okio:jar:1.14.0:test
[INFO] |  |  +- org.seleniumhq.selenium:selenium-java:jar:3.141.59:test
[INFO] |  |  |  +- org.seleniumhq.selenium:selenium-chrome-driver:jar:3.141.59:test
[INFO] |  |  |  +- org.seleniumhq.selenium:selenium-edge-driver:jar:3.141.59:test
[INFO] |  |  |  +- org.seleniumhq.selenium:selenium-firefox-driver:jar:3.141.59:test
[INFO] |  |  |  +- org.seleniumhq.selenium:selenium-ie-driver:jar:3.141.59:test
[INFO] |  |  |  +- org.seleniumhq.selenium:selenium-opera-driver:jar:3.141.59:test
[INFO] |  |  |  +- org.seleniumhq.selenium:selenium-safari-driver:jar:3.141.59:test
[INFO] |  |  |  \- org.seleniumhq.selenium:selenium-support:jar:3.141.59:test

这对我来说似乎表明 TestBench 在 pom 中要求 Selenium 3.141.59 但代码正在寻找版本 4.1.2 我该如何解决这个问题?

Selenium 版本被 Spring 引导依赖管理覆盖。

你可以尝试设置属性:

<selenium.version>4.1.2</selenium.version>

在我的项目中这不起作用我必须设置 属性 加上所有 Selenium 依赖项到我的 pom.xml

  <dependency>
    <groupId>org.seleniumhq.selenium</groupId>
    <artifactId>selenium-api</artifactId>
    <version>${selenium.version}</version>
    <scope>test</scope>
  </dependency>
  <dependency>
    <groupId>org.seleniumhq.selenium</groupId>
    <artifactId>selenium-chrome-driver</artifactId>
    <version>${selenium.version}</version>
    <scope>test</scope>
  </dependency>
  <dependency>
    <groupId>org.seleniumhq.selenium</groupId>
    <artifactId>selenium-edge-driver</artifactId>
    <version>${selenium.version}</version>
    <scope>test</scope>
  </dependency>
  <dependency>
    <groupId>org.seleniumhq.selenium</groupId>
    <artifactId>selenium-firefox-driver</artifactId>
    <version>${selenium.version}</version>
    <scope>test</scope>
  </dependency>
  <dependency>
    <groupId>org.seleniumhq.selenium</groupId>
    <artifactId>selenium-ie-driver</artifactId>
    <version>${selenium.version}</version>
    <scope>test</scope>
  </dependency>
  <dependency>
    <groupId>org.seleniumhq.selenium</groupId>
    <artifactId>selenium-java</artifactId>
    <version>${selenium.version}</version>
    <scope>test</scope>
  </dependency>
  <dependency>
    <groupId>org.seleniumhq.selenium</groupId>
    <artifactId>selenium-opera-driver</artifactId>
    <version>${selenium.version}</version>
    <scope>test</scope>
  </dependency>
  <dependency>
    <groupId>org.seleniumhq.selenium</groupId>
    <artifactId>selenium-remote-driver</artifactId>
    <version>${selenium.version}</version>
    <scope>test</scope>
  </dependency>
  <dependency>
    <groupId>org.seleniumhq.selenium</groupId>
    <artifactId>selenium-safari-driver</artifactId>
    <version>${selenium.version}</version>
    <scope>test</scope>
  </dependency>
  <dependency>
    <groupId>org.seleniumhq.selenium</groupId>
    <artifactId>selenium-support</artifactId>
    <version>${selenium.version}</version>
    <scope>test</scope>
  </dependency>