Sikulix and Selenium integration in Pycharm project - selenium

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

Related

Unable to launch URL in edge browser (using replit platform)- Selenium Python

I tried to use replit online platform for web scraping using selenium in Edge browser. replit automatically install selenium 4.1.3 but I couldn't find msedge-selenium-tools to support this version.
How can I install selenium (3.141) to support msedge-selenium-tools?
Any help will be highly appreciated.
Thank You
Bibek
I don't know much about this online IDE, but I did some testing and found that it seems to be able to control the version of the referenced package via a configuration in the pyproject.toml file.
First, uninstall selenium 4.1.3 in installed Packages. When installing edge-selenium-tools package, you will find that it bundles selenium 3.141 installed with edge-selenium-tools. Second, add this line in pyproject.toml file.
selenium = "^3.141.0"
Something like this:
In addition, for more questions related to IDE replit, I suggest you post your questions in its community, I think there may be someone with more relevant experience who can answer your questions.

How to get sikuli-script.jar for Mac

I want to integrate sikuli with selenium.Can anyone tell how to get sikuli-script jar for mac pc
To integrate sikuli with selenium, we need to follow the below steps.
First Install Java in MacOS
Download sikuli from https://launchpad.net/sikuli/+download
Double-click on “sikulixsetup-1.1.1.jar” to do
Open Eclipse IDE and create a project

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.

A GUI to debug phantomjs script

I am using phantomjs to build a web crawler. My current crawler is a Python script using selenium, which requires a running Firefox browser. While Selenium is good for debugging scripts (as I can use firebug to inspect the webpage), it cannot be deployed on linux servers without GUI. So I am trying to translate my Python script to phantomjs.
To debug phantomjs scripts, I save the page source html and render a png screenshot to disk, and open it in Firefox to inspect the source page. I am wondering if there is a better way to do this, e.g. a plugin for phantomjs, etc.
This little hack is using a simple technique: It grabs the screen as PhantomJS or CasperJS sees it with captureBase64('png') and then it is POSTing the image into the receiving server which then sends it via socket.io to the browser which displays it is as inline image.
The source code is available on github:
https://github.com/maciejjankowski/flaming-octo-puss
I'm not sure if PhantomJS has it, but CasperJS does (and the latter adds some extra functions to PhantomJS)
and use remote debugging as others suggest
As for most of the JS scripts, it's not so trivial to debug phantomjs script, because there is no IDE/compiler behind this.
First, I higly suggest you to read the Troubleshooting section.
As said by torazaburo, your best option is to use Remote Debugging : scripts can be run in a Web Inspector interface-like console : step-in, step-out, break points, local variables... many classic debugger features are available. If you're familliar with Chrome developpers tools, it's pretty the same.
Though not a solution to your Phantomjs troubles,I think Selenium with Python bindings can be used very efficiently as a headless scraper in a Linux environment.
You can use PyVirtualDisplay, a Python wrapper for Xvfb and Xephyr to fake a display.PyVirtualDisplay needs Xvfb as a dependency. On Ubuntu, first install Xvfb:
sudo apt-get install xvfb
then install PyVirtualDisplay from Pypi:
pip install pyvirtualdisplay
Sample Selenium script in Python in a headless mode with PyVirtualDisplay:
#!/usr/bin/env python
from pyvirtualdisplay import Display
from selenium import webdriver
display = Display(visible=0, size=(800, 600))
display.start()
# now Firefox will run in a virtual display.
# you will not see the browser.
browser = webdriver.Firefox()
browser.get('http://www.google.com')
print browser.title
browser.quit()
display.stop()

How to run python scripts against selenium grid

I am able to run python scripts throgh selenium rc.
I dont know to run these scripts in selenium grid.I am not able to get the correct answer from anywhere.is it possible to run python scripts from selenium eclipse.
Please anyone provide me the solution as soon as possible.
Thx.
first of all you have to install selenium with this code:
pip install -U selenium
Alternately, you can download the source distribution from PyPI (e.g. selenium-2.53.1.tar.gz), unarchive it, and run:
python setup.py install
both of the methods described above install selenium as a system-wide package That will require administrative/root access to there machine. You may consider using a virtualenv to create isolated Python environments instead.
You're asking a lot of things that don't really make sense. E.g., there is no such thing as "selenium eclipse." Anyway, I'll try to answer the best I can.
Your Python scripts should have the client connect to the Selenium Grid Hub instead of a specific RC Server. The hub is then responsible for dispatching the request to any registered nodes in the grid. There is nothing Python-specific involved with grid.