robot framework selenium standalone Only Java Installed

孤街醉人 提交于 2019-12-08 09:35:30

问题


I need some help setting up a Robot Framework with Selenium - both standalone. My configuration is Jenkins + RobotFramework + Selenium all in Standalone Mode.

I Want to preconfigure a Job using a test set that is shipped with my self made bundle. In the end I want to make jenkins Job that comes with the selfmade package bundle to something like a automated installation qualification.

Everything starts up fine but my test can not load the selenium libs for web test, my last attemp was the following: -Start Jenkins

java -DJENKINS_HOME="%~dp0\jenkins_home" -jar jenkins.war --httpPort=8081 --webroot="%~dp0\jenkins"

-Start Selenium Server

java -jar selenium-server-standalone-2.42.2.jar 

-Start Robot Job in Jenkins

java -Xbootclasspath/a:selenium-2.45.0/*.jar:selenium-2.45.0/libs/*.jar -jar %JENKINS_HOME%\jenkins_home\robotframework-2.8.7.jar %JENKINS_HOME%\jenkins_home\tests\myTest.txt

Sadly I am facing an error : "Importing test library 'Selenium2Library' failed: ImportError: No module named Selenium2Library" I tried several approaches to get it running.

Because of some preconditions I can not manipulate the contens of the Robot oder any othe .jar Slowly I feel this is impossible.


回答1:


Your test obviously requires Selenium2Library which is not a standard RF library and needs to be installed/downloaded separately.

In this case (running RF from standalone jar) you need the java version of Selenium2Library which can be downloaded from here.

If you have all three jars in a directory you could run your tests from that directory like this:

java -cp robotframework-2.8.7.jar;robotframework-selenium2library-java-1.4.0.6-jar-with-dependencies.jar;selenium-server-standalone-2.42.2.jar org.robotframework.RobotFramework  %JENKINS_HOME%\jenkins_home\tests\myTest.txt

(looks like you are on Windows - otherwise use : as classpath separator)




回答2:


I simply unpacked the selenium .tar package and took out the Libs and put them into %jenkins_home%\Lib\SeleniumLibrary\ This worked for me.



来源:https://stackoverflow.com/questions/29369339/robot-framework-selenium-standalone-only-java-installed

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!