我是一名硒自动化的新手。我创建了一个Selenium测试用例&测试套件。 我将测试套件作为Python webdriver导出。来自Selenium的Python webdriver
我该如何执行这个python代码? 我尝试这样做:
./pythonwebdriver <selenium test case.html>
我得到这个错误:
Traceback (most recent call last):
File "./pythondriver.py", line 52, in <module>
unittest.main()
File "/usr/lib/python2.7/unittest/main.py", line 94, in __init__
self.parseArgs(argv)
File "/usr/lib/python2.7/unittest/main.py", line 149, in parseArgs
self.createTests()
File "/usr/lib/python2.7/unittest/main.py", line 158, in createTests
self.module)
File "/usr/lib/python2.7/unittest/loader.py", line 128, in loadTestsFromNames
suites = [self.loadTestsFromName(name, module) for name in names]
File "/usr/lib/python2.7/unittest/loader.py", line 100, in loadTestsFromName
parent, obj = obj, getattr(obj, part)
AttributeError: 'module' object has no attribute '<testcasename>'
如何运行导出的python脚本?我的问题中提到了错误。 – cppcoder
对不起,我忘了解决运行的部分。我现在已经更新了答案,包括设置单元测试框架并包含运行测试的一些方法。由于您没有提供给出错误的脚本,因此很难说错误究竟是什么,但希望这会有所帮助。 – Edu