edge selenium无头模式
from time import sleep from selenium import webdriver driverfile_path= "msedgedriver.exe" EDGE = { "browserName": "MicrosoftEdge", "version": "", "platform": "WINDOWS", "ms:edgeOptions": { 'extensions': [], 'args': [ '--headless', '--disable-gpu', '--remote-debugging-port=9222', ]} } driver = webdriver.Edge(executable_path=driverfile_path,capabilities=EDGE) driver.get(url) sleep(5) driver.close()
# pip install msedge-selenium-tools from selenium import webdriver from msedge.selenium_tools import EdgeOptions from msedge.selenium_tools import Edge edge_options = EdgeOptions() edge_options.use_chromium = True # 设置无界面模式,也可以添加其它设置 edge_options.add_argument('headless') driver = Edge(executable_path=driverfile_path,options=edge_options) r = driver.get(url) print(driver.title) driver.quit()
===今日我言===========
勇气 让人进步
===================