DevToolsActivePort文件在本地服务器上的DevOps上不存在



我们在运行Robot Framework时遇到问题。自动测试脚本在DevOps构建管道上执行,在windows服务器上的自托管构建代理上运行,并作为服务运行(使用网络服务(

我们收到以下错误-WebDriverException:消息:未知错误:DevToolsActivePort文件不存在

安装了以下版本的chromedriver/chrome的服务器:

安装在d:\驱动器上的ChromeDriver 95.0.4638.69版本(路径=d:/Python/Scripts/ChromeDriver.exe(

安装在c:\驱动器上的Chrome浏览器版本95.0.4638.69(路径:c:\Program Files\Google/Chrome/Application/Chrome.exe(

chromedriver可执行路径在服务器系统环境变量"中;路径";并出现在";路径";在自冲洗构建代理系统的能力。

当使用本地计算机的相关chrome浏览器二进制和chromedriver可执行路径更改Open Browser关键字时,相同的脚本可以在本地计算机上成功运行。

当我们尝试运行自动化脚本时,我们会收到以下web驱动程序错误消息,并且web驱动程序不会启动/生成新的web浏览器:

TC001 Open Google Home Page                                                   
==============================================================================
Open Google Home Page :: Open Google website with the chrome brows... | FAIL |
Parent suite setup failed:
WebDriverException: Message: unknown error: DevToolsActivePort file doesn't exist

代码运行

*** Settings ***
Library  SeleniumLibrary
Library  CL_Auto_Library
Suite Setup      Open Chrome        https://www.google.com/
Suite Teardown   Close All Browsers
*** Variables ***
${chromeserver_options}   ${EMPTY}
${expected_page_title}    Google

*** Test Cases ***
Open Google Home Page
[Documentation]    Open Google website with the chrome browser and validate the user is on the Google home page
Home Page Should be Loaded  ${expected_page_title}
*** Keywords ***
Open Chrome
[Arguments]         ${url}
[Documentation]     Open the Chrome browser and go to the URL provided in the ${url} argument
...                 ${url}      URL of the application being testing

${chromeserver_options}=    Evaluate    sys.modules['selenium.webdriver'].ChromeOptions()    sys, selenium.webdriver
${options.binary_location}    Set Variable    'C:/Program Files/Google/Chrome/Application/chrome.exe' --remote-debugging-port=9515 
Call Method         ${chromeserver_options}   add_argument     --user-data-dir=C:/Temp/ChromeProfile
Call Method         ${chromeserver_options}   add_argument     --profile-directory=Default
Call Method         ${chromeserver_options}   add_argument     --ignore-certificate-errors
Call Method         ${chromeserver_options}   add_argument     --disable-web-security
Call Method         ${chromeserver_options}   add_argument     --disable-gpu
Create Webdriver    Chrome    chrome_options=${chromeserver_options}    executable_path=D:/Python/Scripts/chromedriver.exe
Go To          ${url}
Maximize Browser Window
Home Page Should be Loaded
[Arguments]        ${expected_page_title}
[Documentation]    Validate that the home page of the Google webiste has been successfully loaded
...                ${expected_page_title}  the expected page title of the home page
Wait Until Keyword Succeeds   2x  1s    Title Should Be    ${expected_page_title}

我们让Edge在测试中表现良好。我们现在Chrome有很多问题。

感谢

因此我们更改了的一些参数

我们尝试过无头辩论,但似乎辩论的顺序也很重要。

Call Method      ${chromeserver_options}   add_argument     --user-data-dir=C:/Temp/ChromeProfile
Call Method         ${chromeserver_options}   add_argument     --profile-directory=Default
Call Method         ${chromeserver_options}   add_argument     --headless
Call Method         ${chromeserver_options}   add_argument     --no-sandbox
Call Method         ${chromeserver_options}   add_argument     --disable-dev-shm-usage 
Call Method         ${chromeserver_options}   add_argument     --ignore-certificate-errors
Call Method         ${chromeserver_options}   add_argument     --disable-web-security
Call Method         ${chromeserver_options}   add_argument     --disable-gpu  

相关内容

  • 没有找到相关文章

最新更新