I'm trying to export a Selenium script to Python from the Selenium IDE. I am using a few user-extension.js functions though (which are working in Selenium IDE). After exporting to Python, the generated script looks like this:
from selenium import selenium
import unittest, time, re
class new_selenium_test(unittest.TestCase):
def setUp(self):
self.verificationErrors = []
self.selenium = selenium("localhost", 4444, "*chrome", "http://localhost/")
self.selenium.start()
def test_selenium_assert_something(self):
sel = self.selenium
# sel.assert_something("abc=1", "x=126")
def tearDown(self):
self.selenium.stop()
self.assertEqual([], self.verificationErrors)
if __name__ == "__main__":
unittest.main()
Note that the most interesting line, where I call my user extension code (function "assert_something", which maps on function "assertSomething" in my user-extensions.js file), is commented out. When I activate that line and run the script against Selenium server like this:
py.test new-selenium-test.py
I get an error like this:
AttributeError: 'selenium' object has no attribute 'assert_something'
Any idea why Selenium IDE comments out my custom call, and why it does not execute it from Python?
Note that I have started the Selenium server like this:
java -jar selenium-server-standalone-2.0rc2.jar -userExtensions /path/user-extensions.js
Thanks for your help!