首先下载驱动 https://developer.microsoft.com/en-us/microsoft-edge/tools/webdriver/

然后解压,把解压后的文件夹添加进环境变量path

然后安装两个包:

pip install msedge-selenium-tools selenium

 然后就可以了:

from msedge.selenium_tools import Edge, EdgeOptionsoptions = EdgeOptions()options.use_chromium = Trueoptions.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()

 




python3+msedgedriver用新版msedge进行chrome
文章转载:http://www.shaoqun.com/a/463752.html