51Testing软件测试论坛

标题: appium + python 运行时报错 “AttributeError: 'xxxx' object has no attribute '... [打印本页]

作者: 测试积点老人    时间: 2021-3-30 16:03
标题: appium + python 运行时报错 “AttributeError: 'xxxx' object has no attribute '...
问题:appium + python 运行时报错 “AttributeError: 'xxxx' object has no attribute 'driver'”,刚接触自动化测试,请大神指导!运行报错:
  1. /System/Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7 /Users/TestSty/fm_appiumtest/mypage.py
  2. test_add_contacts (__main__.FmTest) ... ERROR
  3. ERROR

  4. ======================================================================
  5. ERROR: test_add_contacts (__main__.FmTest)
  6. ----------------------------------------------------------------------
  7. Traceback (most recent call last):
  8.   File "/Users/TestSty/fm_appiumtest/mypage.py", line 34, in test_add_contacts
  9.     self.driver.find_element_by_id('cn.thecover.www.covermedia:id/tab_name').click()
  10. AttributeError: 'FmTest' object has no attribute 'driver'

  11. ======================================================================
  12. ERROR: test_add_contacts (__main__.FmTest)
  13. ----------------------------------------------------------------------
  14. Traceback (most recent call last):
  15.   File "/Users/TestSty/fm_appiumtest/mypage.py", line 31, in tearDown
  16.     self.driver.quit()
  17. AttributeError: 'FmTest' object has no attribute 'driver'

  18. ----------------------------------------------------------------------
  19. Ran 1 test in 0.000s

  20. FAILED (errors=2)

  21. Process finished with exit code 0
复制代码



作者: qqq911    时间: 2021-3-31 11:38
包导入的有问题吧
作者: litingting0214    时间: 2021-3-31 16:09
https://blog.csdn.net/libertine1993/article/details/54232474/  参考下这篇文章
作者: bellas    时间: 2021-3-31 16:15
来学习
作者: 郭小贱    时间: 2021-3-31 16:50
def setUP(self):
还是def setUp(self):  
作者: jingzizx    时间: 2021-3-31 17:25
写的有问题吧




欢迎光临 51Testing软件测试论坛 (http://bbs.51testing.com/) Powered by Discuz! X3.2