Integrate Sikuli and Selenium Python on Eclipse IDE

Asked by Anubhav

Hi,

I have followed the steps to use XML-RPC and able to run sikuli script through client python program from command prompt.
Now I want to integrate Sikuli and Selenium-python with Eclipse IDE. So i want to execute the python scipt through Eclipse Python interpretor.

Can you please guide how can i do this ? Any help will be appreciated

Thanks,
Anubhav Goel
+91-9873629900

Question information

Language:
English Edit question
Status:
Answered
For:
SikuliX Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
RaiMan (raimund-hocke) said :
#1

I do not understand the problem you have.

Just do it ;-)

Revision history for this message
Anubhav (foruanubhav) said :
#2

Hi Raiman,

I want to write Sikuli and Selenium-Python code in a single script in Eclipse IDE and run it using a single interpretor.
below is my simple py script.

from sikuli import *
from Screen import Screen
from selenium import webdriver

def MyHCL():
    s=Screen()
    s.click("D:/Anubhav Data/Project/TestSikuli/img/1415965940913.png")
    print ("Sikuli Code")

    driver = webdriver.Firefox()
    driver.get("https://www.myhcl.com")

MyHCL()

However, when i run it through python test, i get an error message “ImportError: No module named sikuli”
When i execute it through Jython test, i get error message "SyntaxError: future feature unicode_literals is not defined”

Can you please suggest if there is any way other than XML-RPC to run both the sikuli\sel code using a single interpretor ?

Any help will be appreciated.

Thanks
Anubhav Goel

Revision history for this message
RaiMan (raimund-hocke) said :
#3

--- general comment: since you are writing Python scripts, you should use Sikuli accordingly:

from sikuli import *
from selenium import webdriver

def MyHCL():
    click("D:/Anubhav Data/Project/TestSikuli/img/1415965940913.png")
    print ("Sikuli Code")

    driver = webdriver.Firefox()
    driver.get("https://www.myhcl.com")

MyHCL()

--- external Jython
you should use the latest Jython version 2.7beta3

--- use of SikuliX in Eclipse with Python plugin
see https://github.com/RaiMan/SikuliX-2014/wiki/Usage-in-Java-programming

Revision history for this message
Anubhav (foruanubhav) said :
#4

Thanks for your help Raiman. I have installed Jython2.7 beta 3 and created a new project in Eclipse IDE.
Now when i am running selenium code, it is giving me below error.

console: Failed to install '': java.nio.charset.UnsupportedCharsetException: cp0.
Traceback (most recent call last):
  File "D:\Anubhav Data\Project\Project4\src\Pkg1\Case1.py", line 7, in <module>
    from selenium import webdriver
ImportError: No module named selenium

Can you please suggest how can i import selenium in new jython project ?
for Python, i have installed selenium through pip. not sure if i need to do same for jython too.

Please help.

Thanks
Anubhav Goel

Revision history for this message
Anubhav (foruanubhav) said :
#5

Just to be more specific, below are the configuration details.

OS : Win 7 32 bit
Python : 2.7
Jython : 2.7beta3
Selenium : 2.44
Browser : Firefox
IDE : Eclipse Helios
Sikuli : 1.0.1

Revision history for this message
RaiMan (raimund-hocke) said :
#6

You either have to make the Jython compatible version of Selenium available in your project setup or you have to add pointers to the relevant parts in the Python installation to your project setup.
The steps are similar to what you have to doe with SikuliX, to use it in Jython projects in Eclipse.

Revision history for this message
hemalatha (hemalathay) said :
#7

Hi,

I want to integrate Sikuli and Selenium-python with Eclipse IDE. So i want to execute the python scipt through Eclipse Python interpretor.

Below are the configuration details that am using.

OS : Win 10 64 bit
Python : 2.7
Jython : 2.7beta3
Selenium : 3.8.0
Browser : Chromedriver
IDE : Eclipse Oxygen
Sikuli : 1.1.1

I am just trying to run below code but am getting below error :

from org.sikuli.script import Pattern, Screen
from selenium.webdriver import chrome

if __name__ == '__main__':
    s = Screen(0)

    img = Pattern("C:\Sikuli_Path\Images_gmail_login\img.PNG")
    img1 = Pattern("C:\Sikuli_Path\Images_gmail_login\img1.PNG")
    img2= Pattern("C:\Sikuli_Path\Images_gmail_login\img2.PNG")
    img3= Pattern("C:\Sikuli_Path\Images_gmail_login\img3.PNG")
    img4 = Pattern("C:\Sikuli_Path\Images_gmail_login\img4.PNG")

    chromedriver = "C:\Users\Hemalatha_Yenupuri\Documents\Webdrivers\chromedriver"
    driver = chrome(chromedriver)
    driver.get("http://www.google.com")
    s.find("img")
    s.type(img,"email login")
    s.find(img1)
    s.click(img1)
    s.wait(img1,10)
    s.type(img2,"<email address hidden>")
    s.type(img3,"irupuney^922")
    s.click(img4)

Error:

Traceback (most recent call last):
  File "C:\Users\Hemalatha_Yenupuri\Ecllipse_Code_Repository\SikuliWithSelenium\src\SeleniumTesting\SikuliTesting.py", line 7, in <module>
    from org.sikuli.script import Pattern, Screen
ImportError: No module named org.sikuli.script

Can you please guide how can i do this ? Any help will be appreciated.

Thanks,
Hemalatha

Revision history for this message
RaiMan (raimund-hocke) said :
#8

Can you help with this problem?

Provide an answer of your own, or ask Anubhav for more information if necessary.

To post a message you must log in.