python selenium无头浏览器

1.无头浏览器

#实现无可视化界面

from selenium.webdriver.chrome.options import Options

chrome_options = Options ()
chrome_options.add_argument('--headless')
chrome _options.add_argument ('--disable-gpu')
bro = webdriver.Chrome (executable path= './chromedriver'
a chrome_options=chrome options)

#如何实现避免监测风险

from selenium.webdriver import ChromeOptions
option = ChromeOptions()
chiver.add_experimental_option('excludeSwitches", ['enable-automation'])

你可能感兴趣的:(笔记,selenium)