selenium无界面操作

无界面操作

from selenium import webdriver
from selenium.webdriver.chrome.options import Options
#无界面设置
chrome_options = Options()
chrome_options.add_argument(’–headless’)
chrome_options.add_argument(’–disable-gpu’)
#谷歌无界面浏览器路径 (下载谷歌无界面浏览器下载
path = r’E:\新建文件夹\第四阶段\day06(1)\ziliao\chromedriver(1).exe’
#创建浏览器对象
driver = webdriver.Chrome(executable_path=path, chrome_options=chrome_options)
driver.get(url)

猜你喜欢

转载自blog.csdn.net/qq_39306128/article/details/90604576