sikuli-driver team mailing list archive
-
sikuli-driver team
-
Mailing list archive
-
Message #40892
Re: [Question #404578]: Currently what is the best way to implement Selenium in Sikuli?
Question #404578 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/404578
Status: Open => Answered
RaiMan proposed the following answer:
yes, is possible.
Since SikuliX is Java based, the Python scripting is supported by the Java based Jython interpreter.
Because of this it is necessary and easily possible to use any Java library and its API in Sikuli scripts.
The "only" thing to do is, to take care, that the respective Java
library jar file is on the Java classpath at runtime.
SikuliX 1.1.1+ comes with a handy convenience feature:
- put the jar (e.g. mylibrary.jar) into the folder <SikuliXAppData>/Extensions
- in your script say load("mylibrary.jar")
this at runtime puts the jar on the Java classpath and so makes it available for importing the needed classes principally like that:
import com.mylibrary.mypackage.SomeClass as Feature1
and then use it according to the rules of Python class usage and the API - example:
aFeature = Feature1()
print aFeature.someMethod(parm1, parm2)
everything has to be used according to the documented Java API dos of
mylibrary.
To use Selenium in a SikuliX script:
- download the jar from the Selenium download page:
- from here: http://www.seleniumhq.org/download/ in section "Selenium standalone server"
- currently version 3.0.1 (download link: https://goo.gl/Lyo36k)
you will get this file in your download folder:
selenium-server-standalone-3.0.1.jar
copy/move it to the folder <SikuliXAppData>/Extensions (see SikuliX
docs)
start the SikuliX IDE and at the beginning of a script add
load("selenium-server-standalone-3.0.1.jar")
Run this script. If it does not produce any errors, then you could start
to add the needed import statements e.g. to load and use the webdriver
API.
The rest is subject to the information about prerequisites, features and
usage of Selenium in a Java based environment (consult the net)
--
You received this question notification because your team Sikuli Drivers
is an answer contact for Sikuli.