是 unity 的游戏,在有虚拟按键的机器上,虽然虚拟按键区域会隐藏起来,但是当用 driver.tap([(x, y)]) 点击该区域时会直接崩溃,比如点屏幕右上角,就直接出现 WebDriverException 的异常(无效坐标)了,具体如下:

Traceback (most recent call last):
  File "/usr/local/lib/python2.7/site-packages/automated_testing-1.0-py2.7.egg/automated_testing/driver/appium_driver.py", line 131, in execute
    return_value = self._click(relative_position=position, img_list=command._images, xpath=command._path, time=command._time, threshold=command._threshold)
  File "/usr/local/lib/python2.7/site-packages/automated_testing-1.0-py2.7.egg/automated_testing/driver/appium_driver.py", line 284, in _click
    self._driver.tap([(x, y)], time)
  File "/Library/Python/2.7/site-packages/appium/webdriver/webdriver.py", line 203, in tap
    action.perform()
  File "/Library/Python/2.7/site-packages/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/webdriver/remote/webdriver.py", line 236, in execute
    self.error_handler.check_response(response)
  File "/Library/Python/2.7/site-packages/appium/webdriver/errorhandler.py", line 29, in check_response
    raise wde
WebDriverException: Message: The coordinates provided to an interactions operation are invalid.

不知道是不是只有我是这样?如果有知道解决方案的麻烦告知一下,谢谢。
我用 adb shell input tap x y 可以成功,实在不行我就转换为 adb 命令好了。

版本信息如下:
OS: macOS 10.12.2
appium --version 为 1.6.1-beta
安卓版本为 6.0


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