解决方案如下:
# -*- coding:utf-8 -*- from selenium import webdriver from selenium.webdriver.chrome.options import Options chrome_options = Options() chrome_options.add_argument('–no-sandbox') chrome_options.add_argument('–disable-dev-shm-usage') chrome_options.add_argument('–headless') chrome_options.binary_location = "C:/Program Files/Google/Chrome/Application/chrome.exe" # 这里是你指定浏览器的路径 driver = webdriver.Chrome(executable_path='chromedriver.exe', options=chrome_options) driver.get('https://www.baidu.com/')
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)