<tfoot id='4ahJ4'></tfoot>

        <small id='4ahJ4'></small><noframes id='4ahJ4'>

        <legend id='4ahJ4'><style id='4ahJ4'><dir id='4ahJ4'><q id='4ahJ4'></q></dir></style></legend>
        • <bdo id='4ahJ4'></bdo><ul id='4ahJ4'></ul>
        <i id='4ahJ4'><tr id='4ahJ4'><dt id='4ahJ4'><q id='4ahJ4'><span id='4ahJ4'><b id='4ahJ4'><form id='4ahJ4'><ins id='4ahJ4'></ins><ul id='4ahJ4'></ul><sub id='4ahJ4'></sub></form><legend id='4ahJ4'></legend><bdo id='4ahJ4'><pre id='4ahJ4'><center id='4ahJ4'></center></pre></bdo></b><th id='4ahJ4'></th></span></q></dt></tr></i><div id='4ahJ4'><tfoot id='4ahJ4'></tfoot><dl id='4ahJ4'><fieldset id='4ahJ4'></fieldset></dl></div>

        MSEdgeDriver (Chromium) 不适用于版本 &gt;= 79.0.313 (Canary)

        时间:2023-07-05

        <small id='XuQ23'></small><noframes id='XuQ23'>

      1. <tfoot id='XuQ23'></tfoot>
        <legend id='XuQ23'><style id='XuQ23'><dir id='XuQ23'><q id='XuQ23'></q></dir></style></legend>
        • <bdo id='XuQ23'></bdo><ul id='XuQ23'></ul>
          <i id='XuQ23'><tr id='XuQ23'><dt id='XuQ23'><q id='XuQ23'><span id='XuQ23'><b id='XuQ23'><form id='XuQ23'><ins id='XuQ23'></ins><ul id='XuQ23'></ul><sub id='XuQ23'></sub></form><legend id='XuQ23'></legend><bdo id='XuQ23'><pre id='XuQ23'><center id='XuQ23'></center></pre></bdo></b><th id='XuQ23'></th></span></q></dt></tr></i><div id='XuQ23'><tfoot id='XuQ23'></tfoot><dl id='XuQ23'><fieldset id='XuQ23'></fieldset></dl></div>
            <tbody id='XuQ23'></tbody>

                • 本文介绍了MSEdgeDriver (Chromium) 不适用于版本 &gt;= 79.0.313 (Canary)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我在脚本中使用带有 Python3 的 Microsoft Edge Webdriver (Chromium).

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

                  webdriver配置如下:

                  The webdriver configuration is as follows:

                  driveroptions = Options()
                  driveroptions.add_argument('--inprivate')
                  driveroptions.add_argument('--disable-infobars')
                  driveroptions.add_argument('--start-maximized')
                  driveroptions.add_argument('--auto-open-devtools-for-tabs')
                  driveroptions.add_argument('--user-data-dir=D:\Selenium_Edge_Chromium_UserData')
                  driveroptions.binary_location = "C:\Users\Administrator\AppData\Local\Microsoft\Edge SxS\Application\msedge.exe"
                  # driver = webdriver.Chrome(options=driveroptions, executable_path="msedgedriver.309.exe", service_log_path="D:\X.txt")
                  driver = webdriver.Chrome(options=driveroptions, executable_path="msedgedriver.exe", service_log_path="D:\X.txt")
                  
                  driver.set_page_load_timeout(40)
                  wait = WebDriverWait(driver, 40)
                  driver.get(base_url)
                  

                  之前运行良好,但是从 79.0.313.0 开始,驱动只是返回错误:

                  It works well previously, but starting with 79.0.313.0, the driver simply returns the error:

                  Message: session not created: No matching capabilities found
                  

                  还有这里的服务日志:

                  [1572262712.029][INFO]: Starting MSEdgeDriver 80.0.315.0 (9e44865e0573123f4459e64bc4e043fee13eb7ec)
                  [1572262712.029][INFO]: Please protect ports used by MSEdgeDriver and related test frameworks to prevent access by malicious code.
                  [1572262712.567][INFO]: [0b47b609c87652c1d1f004bfac456076] COMMAND InitSession {
                     "capabilities": {
                        "alwaysMatch": {
                           "browserName": "chrome",
                           "goog:chromeOptions": {
                              "args": [ "--inprivate", "--disable-infobars", "--start-maximized", "--auto-open-devtools-for-tabs", "--user-data-dir=D:\Selenium_Edge_Chromium_UserData" ],
                              "binary": "C:\Users\Administrator\AppData\Local\Microsoft\Edge SxS\Application\msedge.exe",
                              "extensions": [  ]
                           },
                           "platformName": "any"
                        },
                        "firstMatch": [ {
                  
                        } ]
                     },
                     "desiredCapabilities": {
                        "browserName": "chrome",
                        "goog:chromeOptions": {
                           "args": [ "--inprivate", "--disable-infobars", "--start-maximized", "--auto-open-devtools-for-tabs", "--user-data-dir=D:\Selenium_Edge_Chromium_UserData" ],
                           "binary": "C:\Users\Administrator\AppData\Local\Microsoft\Edge SxS\Application\msedge.exe",
                           "extensions": [  ]
                        },
                        "platform": "ANY",
                        "version": ""
                     }
                  }
                  [1572262712.571][INFO]: [0b47b609c87652c1d1f004bfac456076] RESPONSE InitSession ERROR session not created: No matching capabilities found
                  

                  如果 msedgedriver 版本保持在 79.0.309.0,我仍然可以使用我的脚本.

                  I can still use my script if the msedgedriver version is kept at 79.0.309.0.

                  但是较新版本的 msedgedriver(79.0.313.0、80.0.315.0 等)发生了什么?

                  But what happened to the newer versions of msedgedriver (79.0.313.0, 80.0.315.0 etc.)?

                  他们是否放弃了一些支持的功能?

                  Are they dropping some supported capabilities?

                  更新:

                  Microsoft Edge (Chromium): 80.0.315.0
                  msedgedriver for Microsoft Edge (Chromium): 80.0.315.0
                  ->
                  Message: session not created: No matching capabilities found
                  

                  Microsoft Edge (Chromium): 79.0.313.0
                  msedgedriver for Microsoft Edge (Chromium): 79.0.313.0
                  ->
                  Message: session not created: No matching capabilities found
                  

                  Microsoft Edge (Chromium): 79.0.309.0
                  msedgedriver for Microsoft Edge (Chromium): 79.0.309.0
                  ->
                  (Works well without issue)
                  

                  使用 79.0.309.0(及更早版本)的 msedgedriver:

                  and with 79.0.309.0 (and older) msedgedriver:

                  Microsoft Edge (Chromium): (version before 79.0.309.0)
                  msedgedriver for Microsoft Edge (Chromium): (version before 79.0.309.0, = browser version)
                  ->
                  (Works without issue)
                  

                  Microsoft Edge (Chromium): 79.0.309.0
                  msedgedriver for Microsoft Edge (Chromium): 79.0.309.0
                  ->
                  (Works without issue)
                  

                  Microsoft Edge (Chromium): 79.0.313.0
                  msedgedriver for Microsoft Edge (Chromium): 79.0.309.0
                  ->
                  (Works without issue)
                  

                  Microsoft Edge (Chromium): 80.0.315.0
                  msedgedriver for Microsoft Edge (Chromium): 79.0.309.0
                  ->
                  (Works without issue)
                  

                  PS:我的 GetEdgeDriver.BAT 将当前安装的 Microsoft Edge (Chromium) Canary 浏览器的版本与当前从 https://developer.microsoft.com/en-us/microsoft-edge/tools/webdriver/.如果后者低于前者,则下载 msedgedriver.exe 并覆盖旧的.

                  PS: My GetEdgeDriver.BAT which compares the version of currently installed Microsoft Edge (Chromium) Canary browser with currently downloaded webdriver from https://developer.microsoft.com/en-us/microsoft-edge/tools/webdriver/. If the latter is lower than the former, it downloads the msedgedriver.exe and overwrites the old one.

                  @ECHO OFF
                  SETLOCAL ENABLEDELAYEDEXPANSION
                  REM GNUWIN32 required
                  
                  REM SET ONEDRIVE=%UserProfile%OneDrive
                  REM This file is located in OneDriveFilesBIN
                  SET ONEDRIVE=%~DP0....
                  
                  SET EDGE_DIR=%UserProfile%AppDataLocalMicrosoftEdge SxSApplication
                  
                  IF NOT EXIST "%EDGE_DIR%msedge.exe" ECHO MSEdge not found at %EDGE_DIR%! & GOTO :EOF
                  FOR /F %%I IN ('DIR /B "%EDGE_DIR%" ^| grep -E [0-9]+.[0-9]+.') DO SET MSEDGE_VERSION=%%I& GOTO :MSEDGE_VERSION_RETRIEVED
                  :MSEDGE_VERSION_RETRIEVED
                  ECHO MSEdge browser version: %MSEDGE_VERSION%
                  
                  FOR /F %%I IN ('MSEDGEDRIVER -V ^| awk "{print $2}"') DO SET HAVE_DRIVER_VERSION=%%I& GOTO :HAVE_DRIVER_VERSION_RETRIEVED
                  :HAVE_DRIVER_VERSION_RETRIEVED
                  ECHO MSEdge driver version in OneDrive: %HAVE_DRIVER_VERSION%
                  
                  REM e.g. https://msedgedriver.azureedge.net/79.0.287.0/edgedriver_win64.zip
                  IF %MSEDGE_VERSION% GTR %HAVE_DRIVER_VERSION% (
                      SET URL=https://msedgedriver.azureedge.net/%MSEDGE_VERSION%/edgedriver_win64.zip
                      ECHO.
                      ECHO Downloading !URL! -^> %TEMP%edgedriver_win64_%MSEDGE_VERSION%.zip
                      REM -C -
                      REM continue previous download and skip if existing download
                      REM -k --insecure
                      curl -C - -s -L -k -o "%TEMP%edgedriver_win64_%MSEDGE_VERSION%.zip" -g "!URL!"
                      REM curl -C - -s -L --insecure -o "%TEMP%edgedriver_win64_%MSEDGE_VERSION%.zip" -g "!URL!"
                      REM unzip -uoqq "%TEMP%edgedriver_win64_%MSEDGE_VERSION%.zip"
                      ECHO Extracting %TEMP%edgedriver_win64_%MSEDGE_VERSION%.zip -^> %~DP0msedgedriver.exe
                      REM extract msedgedriver.exe inside edgedriver_win64_%MSEDGE_VERSION%.zip to %ONEDRIVE%FilesBIN folder with the same name
                      REM 7z x -y -o"C:UsersAdministratorOneDriveFilesBIN" "%TEMP%edgedriver_win64_%MSEDGE_VERSION%.zip" msedgedriver.exe > nul
                      7z x -y -o"%ONEDRIVE%FilesBIN" "%TEMP%edgedriver_win64_%MSEDGE_VERSION%.zip" msedgedriver.exe > nul
                  
                      REM MSEDGEDRIVER -V
                      FOR /F %%I IN ('MSEDGEDRIVER -V ^| awk "{print $2}"') DO SET HAVE_DRIVER_VERSION=%%I& GOTO :NEW_DRIVER_VERSION_RETRIEVED
                      :NEW_DRIVER_VERSION_RETRIEVED
                      ECHO New MSEdge driver version in OneDrive: %HAVE_DRIVER_VERSION%
                  )
                  

                  推荐答案

                  终于解决了我的问题.

                  1. 安装/升级 Selenium 3.14 到 Selenium 4.0.0a5
                  2. 将 Python 代码更改为如下所示:

                  # using edge directly, since you can see 'selenium.webdriver.chromium.webdriver' used in site-packagesseleniumwebdriveredgewebdriver.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)
                  

                  这篇关于MSEdgeDriver (Chromium) 不适用于版本 &gt;= 79.0.313 (Canary)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:驱动程序信息:driver.version:ChromeDriver Chrome 使用 Selenium 和 Pyth 下一篇:硒脚本在python上完成后如何保持chrome浏览器窗口打开以重新使用

                  相关文章

                    <small id='Djt9Y'></small><noframes id='Djt9Y'>

                    <tfoot id='Djt9Y'></tfoot>
                      <bdo id='Djt9Y'></bdo><ul id='Djt9Y'></ul>
                    1. <i id='Djt9Y'><tr id='Djt9Y'><dt id='Djt9Y'><q id='Djt9Y'><span id='Djt9Y'><b id='Djt9Y'><form id='Djt9Y'><ins id='Djt9Y'></ins><ul id='Djt9Y'></ul><sub id='Djt9Y'></sub></form><legend id='Djt9Y'></legend><bdo id='Djt9Y'><pre id='Djt9Y'><center id='Djt9Y'></center></pre></bdo></b><th id='Djt9Y'></th></span></q></dt></tr></i><div id='Djt9Y'><tfoot id='Djt9Y'></tfoot><dl id='Djt9Y'><fieldset id='Djt9Y'></fieldset></dl></div>
                    2. <legend id='Djt9Y'><style id='Djt9Y'><dir id='Djt9Y'><q id='Djt9Y'></q></dir></style></legend>