Python driver 设置

options = webdriver.ChromeOptions()
# 不加载图片,加快访问速度
options.add_experimental_option("prefs", {"profile.managed_default_content_settings.images": 2})
# 设置为开发者模式,避免被识别
options.add_experimental_option('excludeSwitches',['enable-automation'])
options.add_experimental_option('useAutomationExtension', False)
#避开滑块
options.add_argument("--disable-blink-features=AutomationControlled")
driver = webdriver.Chrome(executable_path='C:/Python36/chromedriver.exe', options=options)

模糊定位:button[contains(@class,'btn')] 代替原来的 button[@class^='btn']
posted on 2022-11-08 17:34  shaomine  阅读(460)  评论(0编辑  收藏  举报