【问题标题】:Disable "DevTools listening on ws://127.0.0.1..." log message in Robot Framework在 Robot Framework 中禁用“DevTools 正在侦听 ws://127.0.0.1 ...”日志消息
【发布时间】:2021-06-01 06:23:24
【问题描述】:

我正在使用 Robot Framework 中的 SeleniumLibrary 来测试 Web 应用程序。我的测试项目目前仅使用 .robot 文件,其中没有 python 代码,我想禁用此 ChromeDriver 日志消息,该消息出现在控制台日志中的每个测试用例之后。

我目前正在使用:

  • Chrome 驱动程序 v88
  • 谷歌浏览器 v88.0.4324
  • SeleniumLibrary v3.0.0
  • 机器人框架v3.2.2

这是完整的日志消息:

DevTools listening on ws://127.0.0.1:62913/devtools/browser/569eba7c-49ea-4fa7-953a-dee9730b3157

显然,使用 python 代码来解决它是可能的,就像我们在this post 中所做的那样。 但由于我只使用 Robot Framework 文件做所有事情,我想继续这种方式。

我还阅读了 SeleniumLibrary Documentation 寻找一些解决方案,但没有发现对这种情况有用。

有用的代码 - 库导入:

Library     SeleniumLibrary     run_on_failure=Nothing

是否有任何选项可以禁用此日志消息?

【问题讨论】:

    标签: python selenium selenium-webdriver selenium-chromedriver robotframework


    【解决方案1】:

    根据您所链接的答案,这就是您所需要的:

    *** Settings ***
    Library    SeleniumLibrary
    
    *** Test Cases ***
    Silent Chrome
        Open Browser    https://stackoverflow.com    Chrome    options=add_experimental_option("excludeSwitches", ["enable-logging"])
    

    来自Open Browser 关键字的文档:

    字符串格式允许定义 Selenium 选项方法或 Robot Framework 测试数据中的属性及其参数。这 方法和属性名称区分大小写和空格,并且必须 匹配 Selenium 选项方法和属性名称。什么时候 定义一个方法,它必须以与python类似的方式定义: 方法名称,左括号,零到多个参数和关闭 插入语。如果需要为一个定义多个参数 单一方法,参数必须用逗号分隔,就像在 Python。示例:add_argument("--headless") 或 add_experimental_option("key", "value").

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2015-04-14
      • 2018-05-05
      • 2021-09-16
      • 2018-05-06
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多