2 years ago
#75196

slaw
How can I use touchAction with Selenium 4's w3c protocol?
When I use TouchActions in python, the Error is
Message: unknown command: Cannot call non W3C standard command while in W3C mode
With this, ActionChains class works well. This is my python code:
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
#from selenium.webdriver.common.action_chains import ActionChains
from selenium.webdriver.common.touch_actions import TouchActions
mobile_emulation = { "deviceName": "Nexus 5" }
options = Options()
options.add_argument('--headless')
options.add_experimental_option('mobileEmulation', mobile_emulation)
driver = webdriver.Chrome(options=options)
driver.get("http://example.com/")
element = driver.find_element(By.TAG_NAME, 'body')
actions = TouchActions(driver)
actions.tap(element)
#actions.double_tap(element)
#actions.flick(10, 10)
actions.perform()
driver.quit()
- selenium 4.1.0
- ChromeDriver 97.0.4692.71
- Google Chrome 97.0.4692.71
How can I fix it?
python
selenium
selenium-webdriver
selenium4
0 Answers
Your Answer