英文:
How to solve "java.lang.NoSuchFieldError: Companion"
问题
我正在遵循这个[指南][1]来使用Selenium测试Vaadin应用程序。
以下行:
```java
var driver = new ChromeDriver();
产生以下错误:
> java.lang.NoSuchFieldError: Companion
在我的pom.xml
中,我有:
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
</dependency>
<dependency>
<groupId>io.github.bonigarcia</groupId>
<artifactId>webdrivermanager</artifactId>
<version>5.3.1</version>
<scope>test</scope>
</dependency>
<details>
<summary>英文:</summary>
I'm following this [guide][1] to test Vaadin app using Selenium.
The following line:
```java
var driver = new ChromeDriver();
produces the following error:
> java.lang.NoSuchFieldError: Companion
In my pom.xml
I have
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
</dependency>
<dependency>
<groupId>io.github.bonigarcia</groupId>
<artifactId>webdrivermanager</artifactId>
<version>5.3.1</version>
<scope>test</scope>
</dependency>
答案1
得分: 1
添加 <version>
标签到 selenium-java ,然后你就可以开始了:
<!-- https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-java -->
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>4.8.0</version>
</dependency>
英文:
Add the <version>
tag for selenium-java , you will be good to go:
<!-- https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-java -->
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>4.8.0</version>
</dependency>
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论