使用selenium 爬取数据,不弹出浏览器,后台运行,需要代码设置下无头参数配置
#浏览器在后台运行,不弹出页面from selenium.webdriver import Chromefrom selenium.webdriver.chrome.options import Optionsfrom mon.by import By#准备好参数配置(无头参数配置)opt=Options()opt.add_argument("--headless")opt.add_argument("--disable-gpu")web = Chrome(options=opt)web.get("")print(web.title)