chrome_options = Options()
# chrome_options = webdriver.ChromeOptions()
chrome_options.add_experimental_option("debuggerAddress", "xx.xx.xx.xx")
# chrome_options.debugger_address = resp["data"]["ws"]["selenium"]
# ---------------------------优化选项---------------------------------- #
# 禁止图片
chrome_options.add_argument('blink-settings=imagesEnabled=false')
chrome_options.add_argument('--disable-images')
# 禁用JavaScript
chrome_options.add_argument("--disable-javascript")
chrome_options.add_argument("--disable-plugins")
chrome_options.add_argument('--disable-dev-shm-usage')
chrome_options.add_argument('--disable-software-rasterizer')
chrome_options.add_argument('--disable-extensions')
chrome_options.add_argument('--disable-gpu')
chrome_options.add_argument('--disable-java')
chrome_options.add_argument('--no-sandbox')
chrome_options.add_argument('--mute-audio')
chrome_options.add_argument('--single-process')
# 屏蔽webdriver特征
chrome_options.add_argument("--disable-blink-features")
chrome_options.add_argument("--disable-blink-features=AutomationControlled")
chrome_options.add_argument('--incognito') # 无痕模式
# -------------------------------------------------------------------- #
driver = webdriver.Chrome(chrome_driver, options=chrome_options)