无法使用 Selenium 和 Java 11 导入 o​​rg.openqa.selenium.WebDriver [英] Unable to import org.openqa.selenium.WebDriver using Selenium and Java 11

查看:31
本文介绍了无法使用 Selenium 和 Java 11 导入 o​​rg.openqa.selenium.WebDriver的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是 selenium webdriver 和 java 编程的新手.尝试解决 eclipse 2018-12 中的错误无法解析导入 org.openqa.selenium.WebDriver" 我使用的是 java 11, selenium standalone server 3.141.59 .请帮助.我无法导入 jar 文件以下是屏幕截图

I'm new to selenium webdriver and java programming. Trying to resolve the error in eclipse 2018-12 "The import org.openqa.selenium.WebDriver cannot be resolved" Im using java 11, selenium standalone server 3.141.59 . Kindly help. I'm unable to import jar files Below is the screenshot

推荐答案

Asper 不能使用 selenium-java 作为依赖项编译 Java9 模块 似乎 Selenium 包由于 拆分包 无法用 Java 9 编译> 直到 2018 年 5 月 15 日 Selenium 与 Java 9 不完全兼容.

As per Can't compile Java9 module with selenium-java as dependency it seems the Selenium packages can't be compiled with Java 9 due to split packages and till May 15, 2018 Selenium wasn't fully compatible with Java 9.

但根据这个 评论 @Jarob22 提到,Selenium 有效使用 Java 10 就好了.Java 9 已经停产了,如果 10 个有效,那么添加额外的东西来尝试和支持它并没有多大意义.

But as per this comment @Jarob22 mentioned, Selenium works just fine using Java 10. Java 9 is already eol and there's not much point adding extra stuff to try and support just it if 10 works.

但是随着 e57914a的登陆,Simonbas 向我们介绍了 .有了这个可用性 (mhomnag/selenium-@8b9)-reproducer现在实际构建,但您可能必须立即删除WebDriver,然后使用sleepWaiter.

But with the landing of e57914a Simon introduced us with basic JPMS support. With this availability (mhomnag/selenium-java10-reproducer@bc63889) now actually builds but you may have to Remove the WebDriverWaiter and just use a sleep for now.

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

As you are using java.version: '11.0.1', selenium-server-standalone-3.141.59.jar is still not compatible with Java 11. But once Java 11 ships and Buck supports it the toolchain witll be rejiged to support Java 11.

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

The strategic solution will be to install the latest version of JDK 8u212 and execute the @Tests

这篇关于无法使用 Selenium 和 Java 11 导入 o​​rg.openqa.selenium.WebDriver的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆