简体   繁体   English

硒+西库里可运行罐

[英]Selenium + sikuli runnable jar

I have a question regarding selenium with sikuli runnable jar. 我有一个关于sikuli可运行罐子中硒的问题。 I created a code for testing a page and when I run it from eclipse it does everything perfectly, but when I export it as runnable jar and start the script with java -jar filename.jar it gives me the following error: 我创建了一个用于测试页面的代码,当我从eclipse运行它时,它可以完美地完成所有工作,但是当我将其导出为可运行的jar并使用java -jar filename.jar启动脚本时,会出现以下错误:

Exception in thread "main" java.lang.reflect.InvocationTargetException
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.lang.reflect.Method.invoke(Unknown Source)
        at org.eclipse.jdt.internal.jarinjarloader.JarRsrcLoader.main(JarRsrcLoader.java:58)
Caused by: java.lang.ExceptionInInitializerError
        at LogOut.main(LogOut.java:16)
        ... 5 more
Caused by: java.lang.NullPointerException
        at org.sikuli.script.RunTime.init(RunTime.java:635)
        at org.sikuli.script.RunTime.get(RunTime.java:291)
        at org.sikuli.script.RunTime.get(RunTime.java:126)
        at org.sikuli.script.RunTime.get(RunTime.java:316)
        at org.sikuli.script.Region.<clinit>(Region.java:31)
        ... 6 more 

So my question is basically how can jar give me those errors while eclips runs it with no problem. 所以我的问题是,在eclips毫无问题的运行时,jar如何给我这些错误。 My goal is to create a jar that can be executed on another computer so I hope that you can help me figure this out. 我的目标是创建一个可以在另一台计算机上执行的jar,因此希望您能帮助我解决这个问题。 Thanks 谢谢

actually the test script you have created it don't have any issue if you created the jar file the project should contain at least one main method to run actually when you create an any jar file the project files should contain at least one main method hence it's showing the error 实际上,您创建的测试脚本如果您创建了jar文件,则没有任何问题,项目应至少包含一个主要方法,当您创建任何jar文件时,该项目应实际运行,因此项目文件应至少包含一个主要方法,因此显示错误

please visit the link for reference for better understanding 请访问链接以获取更好的理解

https://support.smartbear.com/alertsite/docs/monitors/web/selenium/create-runnable-jar-from-selenium-script-using-eclipse.html https://support.smartbear.com/alertsite/docs/monitors/web/selenium/create-runnable-jar-from-selenium-script-using-eclipse.html

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM