简体   繁体   English

在Linux上运行Selenium WebDriver jar时出错(在Windows上运行正常)

[英]Error while running selenium WebDriver jar on Linux (Working fine on Windows)

I am running a .jar file of selenium Webdriver java code on Linux server but getting below error: 我在Linux服务器上运行Selenium Webdriver Java代码的.jar文件,但出现以下错误:

A JNI error has occurred, please check your installation and try again Exception in thread "main" java.lang.NoClassDefFoundError: org/openqa/selenium/WebDriver 发生了JNI错误,请检查您的安装,然后重试。线程“主”中的异常java.lang.NoClassDefFoundError:org / openqa / selenium / WebDriver

ALL the dependency .jar are added in final .jar file and I am using command : java -jar fileName.jar 所有的依赖项.jar都添加到了最终的.jar文件中,我正在使用命令: java -jar fileName.jar

It looks like its a clear case of missing selenium libraries in your uber jar. 看起来很明显,您的uber jar中缺少硒库。

The best way to check if your jar fileName.jar contains the WebDriver classes is to run something like this : 检查jar fileName.jar包含WebDriver类的最好方法是运行以下命令:

Here's an example 这是一个例子

jar tvf selenium-server-standalone-3.5.0.jar | grep org/openqa/selenium/WebDriver.class
1305 Fri Feb 01 00:00:00 IST 1985 org/openqa/selenium/WebDriver.class

Depending on your uber jar building mechanism, you would need to ensure that you add up the webdriver jars into your uber jar. 根据您的uber jar构建机制,您需要确保将webdriver jar添加到uber jar中。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 在Linux上运行程序时出现错误。 在Windows上运行正常 - Getting Error while running program on linux. On windows it is working fine WebDriver Selenium API:运行已编译的.jar文件时出错 - WebDriver Selenium API: error running compiled .jar file 如何从 Linux 运行 selenium webdriver(目前在 Windows 中工作)? - How to run selenium webdriver from Linux (currently working in windows)? Shell脚本可以在Linux系统上正常运行,但不能在Windows计算机上运行 - Shell script working fine on linux system but not running on windows machine 在Eclipse中运行时启动进程会导致错误,而在运行导出的jar时运行正常 - Starting a process while running in eclipse causes error, while running the exported jar works fine Jar 运行时出现带有 Selenium webdriver 错误的 Java Gradle - Java Gradle with Selenium webdriver error at Jar Runtime 在Linux上运行Selenium时出现异常 - “驱动程序版本未知”错误 - Exception while running Selenium on Linux - 'Driver version unknown' error 运行 Selenium webdriver 时会话未创建异常 - session not created exception while running Selenium webdriver 使用Linux jar在Windows上运行eclipse并为Linux创建可执行jar jar - Running eclipse on windows with linux jar and create an executable jar fir for linux Click()在按钮上不起作用,但是getText()在Selenium Webdriver中与相同的xpath一起正常工作 - Click() not working on a button but getText() works fine with same xpath in selenium webdriver
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM