java - 无法使用 Selenium 和 Java 11 导入 o​​rg.openqa.selenium.WebDriver

标签 java selenium selenium-webdriver webdriver java-11

我是 selenium webdriver 和 java 编程的新手。尝试解决 eclipse 2018-12 中的错误“导入 org.openqa.selenium.WebDriver 无法解析”我正在使用 java 11,selenium 独立服务器 3.141.59。请帮忙。我无法导入 jar 文件 下面是屏幕截图

enter image description here

enter image description here

最佳答案

根据 Can't compile Java9 module with selenium-java as dependency似乎 Selenium 包无法用 Java 9 编译,因为 split packages 直到 2018 年 5 月 15 日 Selenium 与 Java 9 不完全兼容。

但是根据这个comment @Jarob22 提到,Selenium 使用 Java 10 工作得很好。 Java 9 已经停产,如果 10 有效,添加额外的东西来尝试和支持它没有多大意义。

但是随着e57914a的登陆Simon 向我们介绍了基本的 JPMS 支持。有了这个可用性 (mhomnag/selenium-java10-reproducer@bc63889)现在实际构建,但您可能必须 Remove the WebDriverWaiter and just use a sleep for now .


Java 11

由于您使用的是 java.version: '11.0.1'selenium-server-standalone-3.141.59.jar 仍然与 不兼容Java 11。但是一旦 Java 11 发布并且 Buck 支持它,工具链将被重新调整以支持 Java 11


解决方案

战略解决方案将是安装最新版本的 JDK 8u212并执行@Tests

关于java - 无法使用 Selenium 和 Java 11 导入 o​​rg.openqa.selenium.WebDriver,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54876955/

相关文章:

java - 如何在操作监听器中使用 if 语句将文本字段编辑为整数

selenium - 处理 Chrome 上弹出的 Windows 身份验证

testing - 元素内的偏移量无法滚动到 View : (0, 0): http://localhost/groupc/edit/378

java - 如何在测试中只执行一次方法设置

java - 如何使用java并发编程的ExecutorService?

python - 嵌套循环属性错误: __exit__ (Selenium script) when opening file

python - Selenium 选中的节点文本

python - 如何仅在python selenium中获取第一层子元素

java - 如何根据测试环境跳过 Selenium TestNG 测试

java - 如何在 Struts 2 中使用整个通配符值作为重定向结果