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")