[英]python - selenium script syntax error
Okay, I used selenium to test some automation, which I got to work. 好的,我使用硒测试了一些自动化功能,然后开始工作。 I did an export of the script for python.
我为python导出了脚本。 When I tried to run the python script it generated, it gave me a "SyntaxError: invalid syntax" error message.
当我尝试运行它生成的python脚本时,它给了我“ SyntaxError:无效的语法”错误消息。 Here's the python script in question:
这是有问题的python脚本:
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. 最后一行是生成“ SyntaxError:无效语法”错误消息的原因。 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()
较新版本的Python更改了异常处理程序语法。
except AssertionError as e:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.