integrate WebDriver (Selenium 2.0) into Sikuli IDE

Asked by joe fu

I've tried to integrate the WebDriver (Selenium 2.0) into Sikuli IDE, could you give me some hints?

I already have a framework (PyUnit) to successfully integrate Selenium 1.0 with Sikuli IDE, as Selenium supports Python. I can easily call the selenium rc commands inside the Sikuli IDE running environment. It works beautifully.

However I got issue when trying to integrate the WebDriver (Selenium 2.0) into Sikuli IDE. The WebDriver modules in Python do seem to get along well with Jython 2.5 in Sikuli. It seems to me it requires at least Python 2.6 to run the WebDriver Python modules.

  File "C:\GUITest\GUITest.sikuli\configs\globalConfig.py", line 15, in <module>
    from selenium import webdriver
  File "C:\GUITest\GUITest.sikuli\utils\selenium\webdriver\__init__.py", line 18, in <module>
    from firefox.webdriver import WebDriver as Firefox
  File "C:\GUITest\GUITest.sikuli\utils\selenium\webdriver\firefox\webdriver.py", line 21, in <module>
    from selenium.webdriver.remote.webdriver import WebDriver as RemoteWebDriver
  File "C:\GUITest\GUITest.sikuli\utils\selenium\webdriver\remote\webdriver.py", line 676
SyntaxError: 'with' will become a reserved keyword in Python 2.6

Any idea how to resolve the issue here?
do you think it's easier to call Selenium java routines inside Sikuli IDE (using Jython) than making it work for Python 2.6?

This is something you guys may want to consider in the future Sikuli release, to integrate with other open source tools, such as selenium and webdriver. I'm sure it'll benefit lots of QA folks.

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

--- It seems to me it requires at least Python 2.6 to run the WebDriver Python modules
Do you think it might be so or do you know it, because the Selenium 2.0 requirements are telling it?

The currently used Jython interpreter 2.5.2 reflects the Python language level 2.5. The Jython project itself does not clearly tell about their concrete release plans. So currently we have to live with this restriction.

--- SyntaxError: 'with' will become a reserved keyword in Python 2.6
This should not be a problem with the latest version of Sikuli X, because it contains as a standard
from future import with

As a workaround you may forgo the usage of with in your scripts.

--- general comment on Selenium / Sikuli integration
The most flexibility and possibilities you have, when doing the integration on the Java level. For special situations it is possible to integrate the usage of Java classes in your Sikuli scripts.

Revision history for this message
joe fu (jfu-yahoo) said :
#2

I'd think Python 2.6 is the requirement of webdriver, as it complains the above SyntaxError when interpreting the webdriver module in Sikuli X.

how do I do the 'from future import with' in the latest version of Sikuli?

how do I do call java classes in my Sikuli scripts?

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

--- Python 2.6 is the requirement of webdriver, as it complains the above SyntaxError when interpreting the webdriver module in Sikuli X.
You cannot run Sikuli scripts with a Python interpreter. You have to use either the Sikuli built-in features to use the Jython interpreter or use a standalone Jython 2.5.2 Jython version.

--- how do I do call java classes in my Sikuli scripts?
use import to get them known
e.g. (roughly ;-)
import java.awt.Robot as myRobot
r = myRobot.robot()
r.captureScreen()

according to the API docs of the respective classes

Can you help with this problem?

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

To post a message you must log in.