396930154:
selenium 4.1.0
ChromeDriver 97.0.4692.71
Google Chrome 97.0.4692.71
示例代码:
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”, False)
options.add_experimental_option(‘w3c’, False)
service = ChromeService(executable_path=CHROMEDRIVER_PATH)
driver = webdriver.Chrome(service=service, options=options)
driver.get(‘https://www.v2ex.com/’)
actions = TouchActions(driver)
actions.scroll(100,500).perform()
print(‘end’)
去掉 options.add_experimental_option(‘w3c’, False)这句代码会报如下错误:selenium.common.exceptions.WebDriverException: Message: unknown command: Cannot call non W3C standard command while in W3C mode
selenium 版本不降,w3c 且必须设置为 True 的时候还有办法使用 TouchActions 的 scroll 方法吗?
from V2EX-最新主题 https://ift.tt/u3je7kZ
- 本文固定链接: https://niul.net/213913.html
- 转载请注明: 分享菌 于 牛叻网(NiuL.Net) 发表