I am getting the following errors when running a basic Selenium test script in Python:
======================================================================
ERROR: test_untitled (__main__.TestTesting)
----------------------------------------------------------------------
Traceback (most recent call last):
File "TestTesting.py", line 15, in setUp
self.selenium.start()
File "/usr/lib/python2.6/dist-packages/selenium.py", line 166, in start
result = self.get_string("getNewBrowserSession", [self.browserStartCommand, self.browserURL])
File "/usr/lib/python2.6/dist-packages/selenium.py", line 195, in get_string
result = self.do_command(verb, args)
File "/usr/lib/python2.6/dist-packages/selenium.py", line 191, in do_command
raise Exception, data
Exception: Failed to start new browser session: Error while launching browser
----------------------------------------------------------------------
Ran 1 test in 20.427s
FAILED (errors=1)
The code was generated from the Selenium IDE, the firefox plug in, so I am not sure why it doesn't work. My guess is some sort of configuration is incorrect, but I am not sure. Here is my code:
from selenium import selenium
class TestTesting(unittest.TestCase):
def setUp(self):
self.verificationErrors = []
self.selenium = selenium("localhost", 4444, "*firefox", "http://www.google.com/")
self.selenium.start()
def test_untitled(self):
sel = self.selenium
sel.open("/firefox?client=firefox-a&rls=org.mozilla:en-US:official")
sel.type("sf", "test")
sel.click("btnG")
sel.wait_for_page_to_load("30000")
def tearDown(self):
self.selenium.stop()
self.assertEqual([], self.verificationErrors)
if __name__ == "__main__":
unittest.main()
The server is running on Ubuntu.
How can I avoid this error?