TA的每日心情 | 擦汗 5 小时前 |
---|
签到天数: 527 天 连续签到: 4 天 [LV.9]测试副司令
|
1测试积点
问题:
元素不能定位的时候 直接退出报错,is_display() 这样的函数怎么使用?
- <font face="微软雅黑" size="3">def test_findkeyboard(self):
- el = self.driver.find_element_by_class_name('UIAKeyboard')
- print(el.is_displayed())
- 执行以上test的时候直接报错
- An element could not be located on the page using the given search parameters.</font>
复制代码
求助下 is_display()这样的函数应该怎么使用
- <font face="微软雅黑" size="3">/usr/bin/python "/Applications/PyCharm CE.app/helpers/pycharm/utrunner.py" /Users/Alfred/sample-code-master/sample-code/examples/python/sapi_login_test.py::SapiHomePageTests::test_findkeyboard true
- Testing started at 下午5:57 ...
- Error
- Traceback (most recent call last):
- File "/Users/Alfred/sample-code-master/sample-code/examples/python/sapi_login_test.py", line 44, in test_findkeyboard
- el = self.driver.find_element_by_class_name('UIAKeyboard')
- File "/Library/Python/2.7/site-packages/selenium-2.41.0-py2.7.egg/selenium/webdriver/remote/webdriver.py", line 343, in find_element_by_class_name
- return self.find_element(by=By.CLASS_NAME, value=name)
- File "/Library/Python/2.7/site-packages/selenium-2.41.0-py2.7.egg/selenium/webdriver/remote/webdriver.py", line 655, in find_element
- {'using': by, 'value': value})['value']
- File "/Library/Python/2.7/site-packages/selenium-2.41.0-py2.7.egg/selenium/webdriver/remote/webdriver.py", line 166, in execute
- self.error_handler.check_response(response)
- File "build/bdist.macosx-10.9-intel/egg/appium/webdriver/errorhandler.py", line 29, in check_response
- raise wde
- NoSuchElementException: Message: u'An element could not be located on the page using the given search parameters.' </font>
复制代码
|
|