eclipse 类型 org.openqa.selenium.chrome.ChromeDriver 不可访问

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/52245708/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 23:33:56  来源:igfitidea点击:

The type org.openqa.selenium.chrome.ChromeDriver is not accessible

eclipseseleniumselenium-webdriverjava-10

提问by Saurabh Dhingra

I am getting the error like "The type org.openqa.selenium.chrome.ChromeDriver is not accessible" for almost all the classes I am using in Selenium.

对于我在 Selenium 中使用的几乎所有类,我都收到类似“类型 org.openqa.selenium.chrome.ChromeDriver 不可访问”的错误消息。

It was working fine till I was using Java 8 but when I upgraded to Java 10 I am getting errors like this.

在我使用 Java 8 之前它运行良好,但是当我升级到 Java 10 时,我遇到了这样的错误。

See the screenshot of the project below:

请看下面的项目截图:

enter image description here

在此处输入图片说明

Edit 1:

编辑1:

Selenium-server jar file also contains all the webdriver code as well. See the below image. It has the ChromeDriver class in the same package which I have imported in the above class. The same combination is working fine If I am using either Java 8 (again see the below screenshot)or an older version of eclipse say neon. enter image description here

Selenium-server jar 文件也包含所有的 webdriver 代码。见下图。它在我在上面的类中导入的同一个包中有 ChromeDriver 类。如果我使用的是 Java 8(再次参见下面的屏幕截图)或较旧版本的 Eclipse(例如 neon),则相同的组合工作正常。 在此处输入图片说明

enter image description here

在此处输入图片说明

回答by SHERWIN

To avoid such error, You should change java compiler to early version 1.7 or 1.7 from configuring build path.

为避免此类错误,您应该从配置构建路径将 java 编译器更改为早期版本 1.7 或 1.7。

enter image description here

在此处输入图片说明

回答by prabhu hiremath

Delete the latest version of selenium.server.standalone.jar and instal and add to build path any previous version. It worked for me

删除最新版本的 selenium.server.standalone.jar 并安装并添加任何以前版本的构建路径。它对我有用

回答by Beginner

When configuring build path, make sure the external jars are added under classpath folder not under any other folder.

配置构建路径时,请确保将外部 jar 添加到 classpath 文件夹下,而不是任何其他文件夹下。

enter image description here

在此处输入图片说明

Download Jars from following link: https://selenium-release.storage.googleapis.com/index.html?path=4.0/

从以下链接下载罐子:https://selenium-release.storage.googleapis.com/index.html?path =4.0 /

回答by Shrini

Download selenium Client and Webdriver jar form the below link:

从以下链接下载 selenium Client 和 Webdriver jar:

https://www.seleniumhq.org/download/

https://www.seleniumhq.org/download/

回答by user3751632

try this link to understand some setting to work with Java 10 before you use it. Hope this helps : https://www.youtube.com/watch?v=_JNeiGbAgL4&list=PL9ooVrP1hQOFP9H8Y15DVGCA6GavhgJ8a&index=2

在使用 Java 10 之前,请尝试使用此链接了解一些与 Java 10 配合使用的设置。希望这会有所帮助:https: //www.youtube.com/watch?v=_JNeiGbAgL4&list=PL9ooVrP1hQOFP9H8Y15DVGCA6GavhgJ8a&index=2

回答by Bharathi

I faced same issue today with eclipse photon. In the process of fixing the issue, i removed selenium standalone jar and issue was resolved. I could see you added selenium standalone jar to your project. Remove that and try again. Hope that works.

我今天在日食光子上遇到了同样的问题。在解决问题的过程中,我删除了 selenium 独立 jar 并解决了问题。我可以看到您在项目中添加了 selenium 独立 jar。删除它并重试。希望有效。