python selenium显示/不显示浏览器

helei 2021-4-25 1,153 4/25
browser = webdriver.Chrome(executable_path="C:\Program Files (x86)\Google\Chrome\Application/chromedriver.exe")
#无界面模式
def ChromeDriverNOBrowser():
   chrome_options = Options()
   chrome_options.add_argument('--headless')
   chrome_options.add_argument('--disable-gpu')
   driverChrome = webdriver.Chrome(executable_path="C:\Program Files (x86)\Google\Chrome\Application/chromedriver.exe",chrome_options=chrome_options)
   return driverChrome
#有界面模式
def ChromeDriverBrowser():
    driverChrome = webdriver.Chrome(executable_path="C:\Program Files (x86)\Google\Chrome\Application/chromedriver.exe")
    return driverChrome

- THE END -

helei

4月25日11:46

最后修改:2021年4月25日
0

非特殊说明,本博所有文章均为博主原创。