打开一张图片,想要实现缩放的功能,
查看文档,pinch,zoom 可传入元素或坐标来实现

zoom_element = driver.find_element_by_id('某 Id')
# 获取元素的中心坐标
width = zoom_element.size['width']
height = zoom_element.size['height']
x = zoom_element.location['x']
y = zoom_element.location['y']
center_x = x + width / 2
center_y = y + height / 2
sleep(3)
# 传入坐标
#driver.zoom(center_x,center_y);
# 传入元素
#driver.zoom(zoom_element)

传入元素时,提示 selenium.common.exceptions.WebDriverException: Message: Unknown mobile command "pinchClose". Only shell commands are supported.
传入坐标时,提示 ‘folat’is not 'id'

有大神能解答下吗?


↙↙↙阅读原文可查看相关链接,并与作者交流