问答 [IOS] appium 中有些方法不好用,求鉴定

luckysunshine · 2014年09月28日 · 最后由 Tester-Owen 回复于 2018年11月15日 · 1724 次阅读
  1. python driver.hide_keyboard() 运行于模拟器上,该方法不起作用,大家有用过么?

2.

sleep(5) 
origin_el = self.driver.find_element_by_name('Buttons, Various uses of UIButton')
destination_el = self.driver.find_element_by_name('Transitions, Shows UIViewAnimationTransitions')
self.driver.scroll(origin_el, destination_el) 

使用时会报错,如下:

Traceback (most recent call last):
File "ios_uicatalog.py", line 46, in test_text_fields
self.driver.scroll(origin_el, destination_el)
File "build/bdist.macosx-10.9-intel/egg/appium/webdriver/webdriver.py", line 169, in scroll
action.press(origin_el).move_to(destination_el).release().perform()
File "build/bdist.macosx-10.9-intel/egg/appium/webdriver/common/touch_action.py", line 94, in perform
self._driver.execute(Command.TOUCH_ACTION, params)
File "/Library/Python/2.7/site-packages/selenium-2.42.1-py2.7.egg/selenium/webdriver/remote/webdriver.py", line 173, 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
WebDriverException: Message: u'An error occurred while executing user supplied JavaScript.'

共收到 8 条回复 时间 点赞

driver.hide_keyboard() 这个是用来隐藏键盘的

#1 楼 @penghong2014 是的呀,可是运行那句时键盘没有隐藏呢

匿名 #6 · 2014年09月29日

你是不是少了点什么……

def hide_keyboard(self, key_name=None, key=None, strategy=None):
        """Hides the software keyboard on the device. In iOS, use `key_name` to press
        a particular key, or `strategy`. In Android, no parameters are used.

#3 楼 @link1220 那 key_name 应该=神马呢?

匿名 #4 · 2014年09月30日

#4 楼 @luckysunshine 我现在手头没有 iOS 环境验证,不过这个你可以试试嘛
比如,hide_keyboard( "Return" )

有测试过 Appium 对 IOS 效率吗? 比如 页面上信息量比较大 的时候操作里面的元素 appium 会不会咔住,或者是处理起来会很慢 甚至无响应

#6 楼 @justin_jiang sorry.已经不测了。。。

luckysunshine 回复
  1. hide_keyboard hide_keyboard(self, key_name=None, key=None, strategy=None):

Hides the software keyboard on the device. In iOS, use key_name to press a particular key, or strategy. In Android, no parameters are used.
隐藏键盘,iOS 使用 key_name 隐藏,安卓不使用参数

:Args:
- key_name - key to press
- strategy - strategy for closing the keyboard (e.g., tapOutside)
driver.hide_keyboard()

需要 登录 后方可回复, 如果你还没有账号请点击这里 注册