ActionChains in W3C works only 'mouse', want to change it to other types
See original GitHub issueThe problem
Hi, so I’m currently trying to use selenium “ActionChains” with the “appium-python-client” on Windows 10 with the WinAppDriver.
- On appium versions v1.19.1 (+ any prior to v1.20.0), any action chain event seems to work
- However, on v1.20.0+ I keep receiving the following exception message
Note the the same:
- code and version of “appium-python-client” was used
- each version of appium tested also used the same WinAppDriver v1.2-RC (as printed by npm install -g appium@<version>)
Therefore, it seems that the issue stems from the “appium” library and not “WinAppDriver” nor the “appium-python-client”.
Traceback (most recent call last):
File "C:/p4/perforce/depot/qa/tests/licensing/Fuse/dev/tests/failure.py", line 19, in <module>
actions.double_click(two).perform()
File "C:\p4\perforce\depot\qa\tests\licensing\Fuse\dev\venv-379\lib\site-packages\selenium\webdriver\common\action_chains.py", line 80, in perform
self.w3c_actions.perform()
File "C:\p4\perforce\depot\qa\tests\licensing\Fuse\dev\venv-379\lib\site-packages\selenium\webdriver\common\actions\action_builder.py", line 76, in perform
self.driver.execute(Command.W3C_ACTIONS, enc)
File "C:\p4\perforce\depot\qa\tests\licensing\Fuse\dev\venv-379\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 321, in execute
self.error_handler.check_response(response)
File "C:\p4\perforce\depot\qa\tests\licensing\Fuse\dev\venv-379\lib\site-packages\appium\webdriver\errorhandler.py", line 31, in check_response
raise wde
File "C:\p4\perforce\depot\qa\tests\licensing\Fuse\dev\venv-379\lib\site-packages\appium\webdriver\errorhandler.py", line 26, in check_response
super().check_response(response)
File "C:\p4\perforce\depot\qa\tests\licensing\Fuse\dev\venv-379\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 242, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: Currently only pen and touch pointer input source types are supported
Environment
- Python version: Python 3.7.9 (but reproducible on any Python3 version)
- Appium version (or git revision) that exhibits the issue: v.1.20.0+
- Last Appium version that did not exhibit the issue (if applicable): v1.19.1 (any version before v.1.20.0)
- Desktop OS/version used to run Appium: Windows 10 (any version)
- Node.js version: 14.15.4 (should not matter though)
- Npm version: 6.14.10 (should not matter though)
Link to Appium logs
https://gist.github.com/vong0/727ef226073466324ae5631e029fcd13 (logs of both success and fail version)
Code To Reproduce Issue [ Good To Have ]
- Create a virtual environment and only install
Appium-Python-Client==1.0.2
- Install appium failing version
npm install -g appium@1.20.0
- Run the following code segment and check that it fails
- Rerun the code segment for a successful version
npm install -g appium@1.19.1
from appium import webdriver
from selenium.webdriver.common.action_chains import ActionChains
"Microsoft.WindowsCalculator_8wekyb3d8bbwe!App"
desired_caps = {"app": "Microsoft.WindowsCalculator_8wekyb3d8bbwe!App",
"platformName": "Windows",
"deviceName": "WindowsPC",
"newCommandTimeout": 10000}
app = webdriver.Remote(command_executor='http://127.0.0.1:4723/wd/hub',
desired_capabilities=desired_caps)
# Normal actions work
two = app.find_element_by_name("Two")
two.click()
# Any ActionChain event fails
actions = ActionChains(app)
actions.double_click(two).perform()
# actions.move_to_element(two).perform()
Issue Analytics
- State:
- Created 3 years ago
- Comments:10 (7 by maintainers)
Top Results From Across the Web
Action Chains in Selenium Python - GeeksforGeeks
ActionChains are a way to automate low-level interactions such as mouse movements, mouse button actions, keypress, and context menu ...
Read more >How to perform Mouse Actions in Selenium WebDriver
Implementing Selenium tests that involve automating actions like accessing drop-down boxes or clicking or double-clicking on a button element or ...
Read more >Missing perform for selenium ActionChains - Stack Overflow
As per the implementation of ActionChains, perform() is just like another method from the ActionChains Class like move_to_element() ...
Read more >W3C Actions - Appium
Edit this Doc Actions. Perform a chain or multiple chains of keyboard and pointer (touch, mouse, stylus) actions. Example Usage.
Read more >7. WebDriver API — Selenium Python Bindings 2 documentation
Gets a list of the available log types. This only works with w3c compliant browsers. Usage: driver.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@mykola-mokhnach thanks for your help.
For now, I’ve managed to get it working using the
{"forceMjsonwp": True}
hack @KazuCocoa mentioned.I guess I’ll keep using this until appium@2.0 finally comes out:
The issue has nothing to do with Appium python lib. The selenium’s Actions implementation sets pointer type to
mouse
("parameters":{"pointerType":"mouse"}
) by default and that is not supported in WinAppDriver. A possible hack to this: