1. 程式人生 > 實用技巧 >KeyError:使用Python的Appium中的“ touchAction” 錯誤碼

KeyError:使用Python的Appium中的“ touchAction” 錯誤碼

C:\Users\PycharmProjects\AppiumSandbox\venv\Scripts\python.exe C:/Users/PycharmProjects/AppiumSandbox/tests/contactone.py
Traceback (most recent call last):
File “C:/Users/PycharmProjects/AppiumSandbox/tests/contactone.py”, line 21, in
user_action.tap(x=909, y=220).perform()
File “C:\Users\PycharmProjects\AppiumSandbox\venv\lib\site
-packages\appium\webdriver\common\touch_action.py”, line 149, in perform self._driver.execute(Command.TOUCH_ACTION, params) File “C:\Users\PycharmProjects\AppiumSandbox\venv\lib\site-packages\selenium\webdriver\remote\webdriver.py”, line 319, in execute response = self.command_executor.execute(driver_command, params) File “C:\Users\PycharmProjects\AppiumSandbox\venv\lib\site
-packages\selenium\webdriver\remote\remote_connection.py”, line 367, in execute command_info = self._commands[command] KeyError: ‘touchAction’

解決方案


通過新增from appium import webdriver和刪除from selenium import webdriver提到的自動化指令碼可以解決問題