Appium zoom 方法使用无法生效
代码调用如下:
baidu_map=driver.find_element_by_id('com.baidu.BaiduMap:id/f6')
driver.zoom(baidu_map)
方法定义:
def zoom(self, element=None, percent=200, steps=50):
"""Zooms in on an element a certain amount
:Args:
- element - the element to zoom
- percent - (optional) amount to zoom. Defaults to 200%
- steps - (optional) number of steps in the zoom action
:Usage:
driver.zoom(element)
"""
if element:
element = element.id
opts = {
'element': element,
'percent': percent,
'steps': steps,
}
self.execute_script('mobile: pinchOpen', opts)
return self
运行结果:
C:\Python35\python.exe D:/Appium/appium_action/muti_action.py
Traceback (most recent call last):
File "D:/Appium/appium_action/muti_action.py", line 32, in <module>
driver.zoom(baidu_map)
File "C:\Python35\lib\site-packages\appium\webdriver\webdriver.py", line 354, in zoom
self.execute_script('mobile: pinchOpen', opts)
File "C:\Python35\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 627, in execute_script
'args': converted_args})['value']
File "C:\Python35\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 312, in execute
self.error_handler.check_response(response)
File "C:\Python35\lib\site-packages\appium\webdriver\errorhandler.py", line 29, in check_response
raise wde
File "C:\Python35\lib\site-packages\appium\webdriver\errorhandler.py", line 24, in check_response
super(MobileErrorHandler, self).check_response(response)
File "C:\Python35\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 242, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: Unknown mobile command "pinchOpen". Only shell commands are supported.
Process finished with exit code 1
经过谷歌+百度也没找到相关解决方案,查看了一下appium官方论坛也有人反馈这个缩放操作不生效:
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论