← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #248040]: Import Selenium into Sikuli script

 

Question #248040 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/248040

Eugene S gave more information on the question:
Some more investigation I have done in the last couple of hours and
found couple of issues that occur in Selenium because of versions
mismatch:

1. In some selenium files (specifically in
Selenium\webdriver\remote\webdriver.py) a "with" is used when opening
files. That's not supported by Jython and I had to rewrite that part in
Selenium to avoid the exception. So instead:

with open(filename, 'wb') as f:
                f.write(png)

it became:
file = open(filename, 'wb')
file.write(png)

2. "as" is not supported by Jython as well. So in certain cases (like in
Selenium\webdriver\remote\utils.py), where exceptions are used like:

except IOError as err:
        LOGGER.error("Error in extracting webdriver.xpi: %s" % err)
        return None

I changed that to:
except IOError, err:
        LOGGER.error("Error in extracting webdriver.xpi: %s" % err)
        return None

3. I have already mentioned that the following import line fails as well and must be deleted from Selenium code:
from __future__ import unicode_literals


As a result I was able to eliminate certain errors and exceptions however I got stuck at a point when Selenium was trying to import json module which doesn't look available in Jython. Selenium using json quite extensively and bypassing it doesn't seem possible and I have no idea how to progress from here on (of course given the fact that I've done all the rest correctly).

-- 
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.