python - selenium script syntax error
Posted
by
William Hawkes
on Stack Overflow
See other posts from Stack Overflow
or by William Hawkes
Published on 2012-12-12T04:55:58Z
Indexed on
2012/12/12
5:03 UTC
Read the original article
Hit count: 153
Okay, I used selenium to test some automation, which I got to work. I did an export of the script for python. When I tried to run the python script it generated, it gave me a "SyntaxError: invalid syntax" error message. Here's the python script in question:
from selenium import selenium import unittest, time, re
class WakeupCall(unittest.TestCase): def setUp(self): self.verificationErrors = [] self.selenium = selenium("localhost", 4444, "*chrome", "http://the.web.site") self.selenium.start()
def test_wakeup_call(self):
sel = self.selenium
sel.open("/index.php#deposit")
sel.wait_for_page_to_load("30000")
sel.click("link=History")
sel.wait_for_page_to_load("30000")
try: self.failUnless(sel.is_text_present("key phrase number 1."))
except AssertionError, e: self.verificationErrors.append(str(e))
The last line is what generated the "SyntaxError: invalid syntax" error message. A "^" was under the comma. The rest of the script goes as follows:
def tearDown(self):
self.selenium.stop()
self.assertEqual([], self.verificationErrors)
if name == "main": unittest.main()
© Stack Overflow or respective owner