Can I use Sikuli as an Jython library in my project? - jython

Sikuli is really cool, but it's working in its buildin Jython environment, the Sikuli IDE.
So I m wondering is it possible to import Sikuli as an external library to my Jython library? I saw from Sikuli's website that they have this Python module which provides all Sikuli actions like click and type. Here is the link: http://sikuli.org/documentation.shtml#doc/pythondoc-python.edu.mit.csail.uid.Sikuli.html
I have tried importing the skiuli-script.jar and add the skiuli-script/Lib to the PYTHONPATH. Then in my spike.py script, I try to do this:
import python.edu.mit.csail.uid.Sikuli
capture() #enter to screen capture mode
then when execute the script, I got this error:
java.lang.UnsatisfiedLinkError: java.lang.UnsatisfiedLinkError: /eclipse_3.4.2/workspace/Jython/src/tmplib/libVDictProxy.jnilib: no suitable image found. Did find: /eclipse_3.4.2/workspace/Jython/src/tmplib/libVDictProxy.jnilib: no matching architecture in universal wrapper
I m using Jython 2.2.1 and Mac 10.6.2 (32-bit mode). I have also set to use 32-bit mode first in Java Preference.

I tested it with jython 2.5.1 on win32:
I have to include the win32 dir in the PATH
on your mac installation you have to add the templib Directory to your path
see the sikuli-script.sh
sikuliscript is build to run with jython 2.5.x.
a 2.5 jython is included in the sikuli-script.jar
the test-script :
import python.edu.mit.csail.uid.Sikuli as Sikuli
Sikuli.capture() #enter to screen capture mode
putting it all together i think the answer is :
YES

Related

Python error importing dll files while py file import is successful

I have the setup as seen in the attached image:
Both the pyd and functions.py file are defined in the same folder yet the error is only at importing pyd file.
The error is ModuleNotFoundError: No module named marketPriceMarcoPolo
I am not sure what is going on.
Edit:
The pyd file was generated on Python 3.7 and is being used on a PC with Python 3.8 installed. Does it matter?
The pyd file was generated on Python 3.7 and is being used on a PC with Python 3.8 installed. Does it matter?
Yes, it matters. It's in the name of the build (.cp37-amd_win64). That means the extension is built for use with CPython 3.7 64-bit on Windows.
Extensions are linked to an explicit Python version. When you run your script on Python 3.8, it will look for marketPriceMarcoPolo.cp38-win_amd64.pyd instead. Build it with the Python you intend to use it with.

JMeter with Python Selenium

I was checking how i can use existing selenium scripts written in python for JMeter. There are suggestions to use Jython. i have installed jython by putting jython jar file in lib.
Using JSR223 Sampler, when I tried to give the existing selenium script file it is giving me below error while hitting run
> Data type ("text"|"bin"|""):text Response code:500 Response
> message:javax.script.ScriptException: ImportError: No module named selenium in <script> at line number 1
Do i need to use third party tool to convert existing scripts to JMX file?
My second question is :- I checked the documentation and found that it works on python2.7 version. Is that really correct? How come it is not updated to python3
No module named selenium in
It looks like you didn't install selenium module, you need to install it in order to be able to use it like:
jython -m pip install selenium
More information: How can I install various Python libraries in Jython?
However if you want to use existing Python UI tests for performance testing it's better to consider converting them to JMeter's HTTP Request samplers, as each thread (virtual user) needs to run a real browser and a real browser needs 1 CPU core and a couple of gigabytes of RAM so you can simulate thousands of users on HTTP protocol level using the hardware allowing to launch several browsers only.
See How to Convert Selenium Scripts into the JMX Converter article for more details.

Packaging with Pyinstaller - PyQt5 setStyle ignored

I'm actually have an similar issue as described here after update python, pyistaller, pyqt5, pyqt5-tools. Before I got the desired "Windows Vista-style" without app.setStyle('windowsvista') when I run the compiled stand-alone executable.
Now I got the Windows "Classic-style" instead. If I start the application in PyCharm it will use the desired "Windows Vista-style".
Currently installed on Win7 64bit:
Python : 3.6.4
PyInstaller: 3.3.1
PyQt5 : 5.10
pyqt5-tools: 5.9.0.1.2 (update to 5.9.1.1 doesn't work)
Does anyone have any idea why PyInstaller ignored the style?
The error seems to have been fixed in a unmerged branch of PyInstaller. More information can be found on the GitHub pull request conversation, but reinstalling PyInstaller using pip install https://github.com/bjones1/pyinstaller/archive/pyqt5_fix.zip fixed the same style issue for me on Mac.

Sikulix and Selenium integration in Pycharm project

Looking for step-by-step instructions how to integrate Sikulix with Selenium in Pycharm IDE. Would like to combine Sikuli and selenium webdriver for unittesting.
I have already downloaded SikuliX as standalone IDE for Jython2.7. In my Pycharm IDE I have some sikuli packages available. See attached. I do not know which ones to download. Also, still confused if I need to dowload Jython or not.
Please help.
1) Download selenium python bindings from https://pypi.python.org/simple/selenium/
2) Extract that to a folder and run python setup.py install from there.
3) Now, copy the generated "selenium" folder to your \python\Lib and \jython\Lib root directories
4) Test your code by typing "from selenium import webdriver" in your file.
5) For sikuli, just edit your pycharm run configuration and include this in your environment variables "CLASSPATH=C:\Sikuli\sikulixapi.jar;PYTHONUNBUFFERED=1"
6) Use jython as your project interpreter

Pycharm can not auto complete selenium package

I install selenium through Python pip and write a simple file called crawlTest.py, it works well.Later, I install Pycharm and try to auto complete method from selenium, but it doesn't work.
I guess Pycharm didn't know where I install selenium and an external library is needed.But I try by myself and search on google and StackOverflow, I didn't get proper solution.
I have read the flowing posts, but still not work. It is very useful and
time-saving for those who use selenium and Pycharm if some one could give me .
here is post list I hava viewed:
How to get PyCharm to auto-complete code in methods?
PyCharm doesn't auto-completes very simple cases such as: import pickle
I install selenium by python pip, and it works with python3.5,but not python 2.7. so I changed my project interpreter as python 3.5 in Py . Now it works!
for use auto-complete Pycharm feture go to "File\Setting\Project:" add new interpreter and select you instaleed python directory.