当我在Appium下使用python测试iOS应用时,如何发送返回键/输入键?
我尝试了self.driver.press_keycode(66)
。但是,它引发了一个selenium webdriver
问题
File "/Users/workspace/IOSBDD/lib/driver_helpers.py", line 99, in input_and_enter
self.driver.press_keycode(66)
File "/Usersworkspace/IOSBDD/venv3/lib/python3.7/site-packages/appium/webdriver/webdriver.py", line 695, in press_keycode
self.execute(Command.PRESS_KEYCODE, data)
File "/Users/workspace/IOSBDD/venv3/lib/python3.7/site-packages/selenium/webdriver/remote/webdriver.py", line 321, in execute
self.error_handler.check_response(response)
File "/Users/workspace/IOSBDD/venv3/lib/python3.7/site-packages/appium/webdriver/errorhandler.py", line 29, in check_response
raise wde
File "/Users/workspace/IOSBDD/venv3/lib/python3.7/site-packages/appium/webdriver/errorhandler.py", line 24, in check_response
super(MobileErrorHandler, self).check_response(response)
File "/Users/workspace/IOSBDD/venv3/lib/python3.7/site-packages/selenium/webdriver/remote/errorhandler.py", line 242, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: Method has not yet been implemented
我应该将66换成另一个号码吗?或者是其他东西?
答案 0 :(得分:0)
我可以说出什么不太可行(Python绑定以及iOS> = 9.X的时间)。
driver.send_keys("\n")
driver.send_keys("\uE007')
出于测试目的,您可以做两件事。找到关闭或完成该视图的元素,然后单击它。或在屏幕键盘上找到Enter键(应该会在此时出现。)我本人最终还是选择了前一种方法。
答案 1 :(得分:0)
您可以使用
self.driver.hide_keyboard('Go')
或
self.driver.hide_keyboard('return')
根据您的要求。
对我来说,两个人的魅力都一样。