首先下載驅動 https://developer.microsoft.com/en-us/microsoft-edge/tools/webdriver/
然后解壓,把解壓后的檔案夾添加進環境變數path
然后安裝兩個包:
pip install msedge-selenium-tools selenium
然后就可以了:
from msedge.selenium_tools import Edge, EdgeOptions
options = EdgeOptions()
options.use_chromium = True
options.binary_location = r"C:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe"
options.add_argument("headless")
options.add_argument("disable-gpu")
browser = Edge(options = options)
browser.get('https://www.google.com')
browser.save_screenshot('google.png')
print('done')
browser.quit()
轉載請註明出處,本文鏈接:https://www.uj5u.com/ruanti/1019.html
標籤:面向對象
上一篇:Wpf 自定義截圖的實作
