用的pycharm,写appium的自动化测试脚本,run的时候报错,看看哪位能给点提示,谢谢
在BasePage里我封装了setUp,tearDown,还有一些常用的定位控件、控件操作等方法,然后在LoginPage里封装定义了login、logout等方法,最后...
在BasePage里我封装了setUp,tearDown,还有一些常用的定位控件、控件操作等方法,然后在LoginPage里封装定义了login、logout等方法,最后test_login里调用了BasePage、LoginPage的方法来实现登录登出操作,但好像在BasePage里定义常用定位控件的方法都没法调用Webdriver的方法,然而如果是一个py文件里直接调用webdriver的方法,如self.driver.find_element_by_id就可以正常跑起来,封装后再调用就不行
刚开始接触appium,请各位给点帮助,谢谢
python版本是2.7.13,appium是1.4.13
======================================================================
ERROR: test_Mobilelogin (__main__.testlogin)
----------------------------------------------------------------------
Traceback (most recent call last):
Traceback (most recent call last):
File "F:/WebRTC/Testcase/test_login.py", line 46, in test_Mobilelogin
File "F:/WebRTC/Testcase/test_login.py", line 31, in tearDown
self.click_keys("id", phonenumber)
self.driver.quit()
AttributeError: 'str' object has no attribute 'quit'
File "F:\WebRTC\PO\BasePage.py", line 37, in click_keys
self.find_element(el, loc).click()
----------------------------------------------------------------------
File "F:\WebRTC\PO\BasePage.py", line 30, in find_element
Ran 1 test in 21.271s
element = self.driver.find_element_by_id(loc)
AttributeError: 'str' object has no attribute 'find_element_by_id'
FAILED (errors=1) 展开
刚开始接触appium,请各位给点帮助,谢谢
python版本是2.7.13,appium是1.4.13
======================================================================
ERROR: test_Mobilelogin (__main__.testlogin)
----------------------------------------------------------------------
Traceback (most recent call last):
Traceback (most recent call last):
File "F:/WebRTC/Testcase/test_login.py", line 46, in test_Mobilelogin
File "F:/WebRTC/Testcase/test_login.py", line 31, in tearDown
self.click_keys("id", phonenumber)
self.driver.quit()
AttributeError: 'str' object has no attribute 'quit'
File "F:\WebRTC\PO\BasePage.py", line 37, in click_keys
self.find_element(el, loc).click()
----------------------------------------------------------------------
File "F:\WebRTC\PO\BasePage.py", line 30, in find_element
Ran 1 test in 21.271s
element = self.driver.find_element_by_id(loc)
AttributeError: 'str' object has no attribute 'find_element_by_id'
FAILED (errors=1) 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询