Python 3 + msedgedriver tests chrome handles with the new version of msedge

Time:2020-9-7

Download the driver first https://developer.microsoft.com/en-us/microsoft-edge/tools/webdriver/

Then unzip and add the extracted folder to the environment variable path

Then install two packages:

pip install msedge-selenium-tools selenium

Then you can:

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