【问题标题】:Robot Framework + Sauce labs can't recognize the Browser Edge nameRobot Framework + Sauce labs 无法识别 Browser Edge 名称
【发布时间】:2022-07-25 21:07:32
【问题描述】:

我在 Sauce 实验室运行我的机器人框架测试,对于 chrome/firefox/safari,没关系。但是对于 Edge,Sauce labs 无法识别 Edge 浏览器名称。

我尝试使用“边缘”,它抱怨。 "配置错误 -- 不支持的操作系统/浏览器/版本/设备组合:操作系统:'Windows 10',浏览器:'edge',版本:'97',设备:'未指定'"

我尝试使用“MicrosoftEdge”,它抱怨“ValueError:microsoftedge 不是受支持的浏览器。”

Robot framework+sauce lab 的正确 Edge 名称是什么?我的测试用例如下,欢迎提出任何建议。谢谢。

test
   &{SAUCE_OPTIONS}    Create Dictionary    extendedDebugging=${True}
    ...    capturePerformance=${True}
    ...    seleniumVersion=4.0.0
    ...    name=RF_Test
    ...    build='demo'
    &{DESIRED_CAPABILITIES}    Create Dictionary
    ...    browserName=MicrosoftEdge
    ...    platform=Windows 10
    ...    browserVersion=latest
    ...    sauce:options=&{SAUCE_OPTIONS}
    ${remote_url}    Set Variable    https://sauceUserName:sauce_a...@ondemand.us-west-1.saucelabs.com:443/wd/hub
    Open Browser    https://google.com
    ...    browser=${DESIRED_CAPABILITIES['browserName']}
    ...    remote_url=${remote_url}
    ...    desired_capabilities=${desired_capabilities}
    # ...    options=${options}
    Sleep    5s
    Close Browser

【问题讨论】:

    标签: robotframework saucelabs


    【解决方案1】:

    它没有很好的文档记录,当在本地使用时,它可以使用多个值,但它标识自己的一个值是msedge

    2022-02-21 12:44:53 INFO Selenium    >>> http://127.0.0.1:9515/session | {"capabilities":{"alwaysMatch":{"browserName":"MicrosoftEdge","unhandledPromptBehavior":"ignore","ms:edgeOptions":{}}}}
    
    2022-02-21 12:45:00 INFO Selenium <- {"value":{"capabilities":{"acceptInsecureCerts":false,"browserName":"msedge","browserVersion":"98.0.1108.51","ms:edgeOptions":{"debuggerAddress":"localhost:52338"},"msedge":{"msedgedriverVersion":"98.0.1108.56 (9a336a18eae89157b3c7ea0568a9cbced8ebc3f7)","userDataDir":"/var/folders/fx/nlx77ccs72g808pr1994_xtw0000gn/T/.com.microsoft.edgemac.5dBA6q"},"networkConnectionEnabled":false,"pageLoadStrategy":"normal","platformName":"mac os x","proxy":{},"setWindowRect":true,"strictFileInteractability":false,"timeouts":{"implicit":0,"pageLoad":300000,"script":30000},"unhandledPromptBehavior":"ignore","webauthn:extension:credBlob":true,"webauthn:extension:largeBlob":true,"webauthn:virtualAuthenticators":true},"sessionId":"103b9fc98e46a159a3d91effe98e5d33"}}
    

    不过,对于 Sauce Labs,请使用平台配置器查看您应该发送给 Sauce Labs 的确切内容 — https://saucelabs.com/platform/platform-configurator

    代码已更新为使用 Selenium 库而不是 Robot,因此如果您从头开始创建它,您可以从 node.js + w3c 选项卡中看到预期的内容。

    您的特定代码不起作用,因为您需要使用platformName 而不是platform

    【讨论】:

    • 嗯,即使我使用platformName,它仍然无法识别Edge。同样的错误。好困惑。
    • 您收到的错误信息是什么?
    【解决方案2】:

    我不确定这是机器人框架问题还是酱实验室问题。但我可以做一些技巧让 Edge 与 RF+Sauce 实验室一起工作。 问题发生在关键字打开浏览器中的浏览器参数处。如果只是将此浏览器保留为默认 Firefox,并在酱实验室所需的功能中指定“MicrosoftEdge”。测试将按预期运行。 这个技巧唯一的坏处是当你阅读 RF 日志文件时,它说 “通过远程服务器打开浏览器 'firefox' 到基础 url 'https://XX.com' ..., 实际上,它是在打开 Edge 浏览器。

    test
       &{SAUCE_OPTIONS}    Create Dictionary    
        ...    name=RF_Test
        ...    build='demo'
        &{DESIRED_CAPABILITIES}    Create Dictionary
        ...    browserName=MicrosoftEdge
        ...    platform=Windows 10
        ...    browserVersion=latest
        ...    sauce:options=&{SAUCE_OPTIONS}
        ${remote_url}    Set Variable    https://sauceUserName:sauce_a...@ondemand.us-west-1.saucelabs.com:443/wd/hub
        Open Browser    https://google.com
        ***#...    browser=${DESIRED_CAPABILITIES['browserName']}#get rid of this parameter#***
        ...    remote_url=${remote_url}
        ...    desired_capabilities=${desired_capabilities}
        Sleep    5s
        Close Browser
    

    【讨论】:

      【解决方案3】:

      我会选择 Edge,你没有提到你是否尝试过那个。

      文档不清楚browserName 的示例。 也阅读WebDriver W3C Specification 确实给出了答案。

      【讨论】:

      • 谢谢。但是我尝试在我的代码中使用'Edge',同样的问题是抱怨“WebDriverException:消息:配置错误-不支持的操作系统/浏览器/版本/设备组合:操作系统:'Windows 10',浏览器:'edge',版本:'最新的',设备:'未指定'"
      • 你仍然显示小写的 Edge。试试 Pascal 案例,Edge。
      • 这很奇怪。我在我的代码中使用“Edge”。但我不知道为什么它抱怨“边缘”。这是我的日志文件,KEYWORD &{DESIRED_CAPABILITIES} = BuiltIn 。创建字典 browserName=Edge, platformName=Windows 10, browserVersion=90, sauce:options=&{SAUCE_OPTIONS} 文档:根据给定项目创建并返回字典。开始/结束/经过:20220221 14:43:07.925 / 20220221 14:43:07.926 / 00:00:00.001 14:43:07.926 INFO &{DESIRED_CAPABILITIES} = { browserName=Edge |平台名称=Windows 10 |浏览器版本=90 |酱汁:options={'name': 'RF_Test', 'build': "'demo'"} }
      • 好的。也许您只需要使用最少的强制性选项。例如,您请求的浏览器版本可能是缺失的版本,因此配置失败。
      • Sauce Labs 要求 browserNameMicrosoftEdgebrowserVersionlatest 是有效的。
      【解决方案4】:

      @Geri,对此问题有任何解决方案吗? Edge 也存在同样的问题。

      【讨论】:

      猜你喜欢
      • 2017-12-16
      • 2015-11-25
      • 2018-09-21
      • 1970-01-01
      • 2018-06-30
      • 2012-06-24
      • 2019-09-26
      • 2018-01-01
      • 2021-12-07
      相关资源
      最近更新 更多