[英]NoClassDefFoundError: org/apache/http/conn/SchemePortResolver - Selenium
I have the below code for selenium 我有下面的硒代码
public static void main(String[] args) {
File file = new File("C:\\path\\IEDriverServer.exe");
System.setProperty("webdriver.ie.driver", file.getAbsolutePath());
WebDriver driver = new InternetExplorerDriver();
driver.get("http://hedtq01vr.bcbsma.com:8080/tm/index.jsp?default");
driver.quit();
}
When i try to run it fails with the below error: 当我尝试运行时,失败并显示以下错误:
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/http/conn/SchemePortResolver
Below are the jars on the build path: 以下是构建路径上的jar:
and IEDriverServer.exe on the C:\\path folder 和IEDriverServer.exe放在C:\\ path文件夹中
Why am i getting this error..The page here doesn't talk anything about the required libraries. 我为什么会收到此错误。.此页面上没有讨论所需的库。
Any suggestions? 有什么建议么?
EDIT: 编辑:
After adding the libraries from the selenium folder, I am getting the below error: 从selenium文件夹添加库后,出现以下错误:
Exception in thread "main" java.lang.NoSuchFieldError: INSTANCE
The Selenium download comes as a ZIP file ( selenium-java-2.42.2.zip ), which contains not only Selenium-java-2.42.2.jar, but also a sub-directory named 'libs', and which contains a whole raft of JAR libraries that the Selenium jar presumably relies on. Selenium下载以ZIP文件( selenium-java-2.42.2.zip )的形式提供,它不仅包含Selenium-java-2.42.2.jar,还包含一个名为'libs'的子目录,并且包含一个整体Selenium jar可能依赖的大量JAR库。 Among others the libs folder contains httpclient-4.3.2.jar, which is the Apache HTTP component containing the class your current setup cannot find.
其中的libs文件夹包含httpclient-4.3.2.jar,这是Apache HTTP组件,其中包含您当前设置无法找到的类。 Add all the jars in the libs directory on your build path (and then on your classpath at runtime), and you should be sorted.
将所有jar添加到构建路径(然后在运行时的类路径)的libs目录中,然后应进行排序。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.