print('start')
from selenium import webdriver
from selenium.webdriver.common.touch_actions import TouchActions
from selenium.webdriver.chrome.service import Service as ChromeService
options = webdriver.ChromeOptions()
options.add_experimental_option("excludeSwitches", ["enable-automation"])
options.add_experimental_option("useAutomationExtension", True)
options.add_experimental_option('w3c', True)
service = ChromeService(executable_path=CHROMEDRIVER_PATH)
driver = webdriver.Chrome(service=service, options=options)
driver.get('https://stackoverflow.com/')
actions = TouchActions(driver)
actions.scroll(0,500).perform()
print('end')
As shown above,when running the code 'actions.scroll',it throws an exception as:
selenium.common.exceptions.WebDriverException: Message: unknown command: Cannot call non W3C standard command while in W3C mode
I don't want to modify the configuration 'w3c' as 'False',is there any other way to use TouchActions in selenium 4? The operating environment is as follows:
- selenium 4.1.0
- ChromeDriver 97.0.4692.71
- Google Chrome 97.0.4692.71