MSEdgeDriver (Chromium) does not work with version >= 79.0.313 (Canary)

后端 未结 3 1796
[愿得一人]
[愿得一人] 2021-01-15 09:33

I\'m using Microsoft Edge Webdriver (Chromium) with Python3 in my script.

The webdriver configuration is as follows:

driveroptions = Options()
driver         


        
相关标签:
3条回答
  • 2021-01-15 09:42

    I tried the capabilities like below, it worked, you can have a try:

    {
        "desiredCapabilities": {
                "nativeEvents": false,
                "browserName": "chrome",
                "version": "",
                "platform": "ANY",
                "javascriptEnabled": true,
                ...
        }
    }
    
    0 讨论(0)
  • 2021-01-15 09:43

    Browser and webdriver must match the first 3 tuples in version number.

    In chrome there is a version check that tells you if browser and webdriver does not match. msedge gives the more diffuse: No matching capabilities found

    I'm using the chocolately Microsoft Edge Insider - Beta which installse the msedge browser, it is currently at version 79.0.309.65.

    it means I can't use the latest 79.x msedgedriver which currently is at 79.0.313.0, I have to use the 79.0.309.x.

    I've implemented a simple test in my selenium driver that check this before starting.

    0 讨论(0)
  • 2021-01-15 09:53

    Finally solved my question.

    1. Install/Upgrade Selenium 3.14 to Selenium 4.0.0a5
    2. Change the Python code to something like the following:
    # using edge directly, since you can see 'selenium.webdriver.chromium.webdriver' used in site-packages\selenium\webdriver\edge\webdriver.py
    from selenium import webdriver
    from selenium.webdriver.edge.options import Options
    from selenium.webdriver.edge.service import Service
    from selenium.webdriver.edge.webdriver import WebDriver
    ...
    ...
    driveroptions = Options()
    # remember to set use_chromium
    driveroptions.use_chromium = True
    driveroptions.add_argument('--start-maximized')
    driveroptions.binary_location = env_programfiles_x86 + "\\Microsoft\\Edge\\Application\\msedge.exe"
    
    service = Service(executable_path="msedgedriver.exe")
    driver = webdriver.Edge(options=driveroptions, service=service)
    
    driver.set_page_load_timeout(40)
    driver.get(page_url)
    
    0 讨论(0)
提交回复
热议问题