Python驱动Headless Chrome

Headelss 比Headed的浏览器在内存消耗,运行时间,CPU占用都更具优势

from selenium import webdriver
from selenium.webdriver.chrome.options import Options
chrome_options = Options()
chrome_options.add_argument("--headless")
self.driver = webdriver.Chrome(executable_path=(r"C:\Users\yujing\AppData\Local\Programs\Python\Python37\chromedriver.exe"), chrome_options=chrome_options)
self.driver.maximize_window()
self.driver.get("http://120.79.176.157:8012/Index/login.html")
posted @ 2018-09-21 15:18  薏米*  阅读(284)  评论(0编辑  收藏  举报