在 Robot Framework 中禁用 "DevTools listening on ws://127.0.0.1..." 日志消息
Disable "DevTools listening on ws://127.0.0.1..." log message in Robot Framework
我正在使用 Robot Framework 中的 SeleniumLibrary 来测试 Web 应用程序。我的测试项目目前仅使用 .robot
文件,其中没有 python 代码,我想禁用此 Chrome 驱动程序日志消息,该消息出现在控制台日志中的每个测试用例之后.
我目前正在使用:
- Chrome驱动程序v88
- Google Chrome 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
是否有禁用此日志消息的选项?
根据您链接的答案,这就是您所需要的:
*** Settings ***
Library SeleniumLibrary
*** Test Cases ***
Silent Chrome
Open Browser https://whosebug.com Chrome options=add_experimental_option("excludeSwitches", ["enable-logging"])
来自 Open Browser
关键字的文档:
The string format allows defining Selenium options methods or
attributes and their arguments in Robot Framework test data. The
method and attributes names are case and space sensitive and must
match to the Selenium options methods and attributes names. When
defining a method, it must be defined in a similar way as in python:
method name, opening parenthesis, zero to many arguments and closing
parenthesis. If there is a need to define multiple arguments for a
single method, arguments must be separated with comma, just like in
Python. Example: add_argument("--headless")
or
add_experimental_option("key", "value")
.
我正在使用 Robot Framework 中的 SeleniumLibrary 来测试 Web 应用程序。我的测试项目目前仅使用 .robot
文件,其中没有 python 代码,我想禁用此 Chrome 驱动程序日志消息,该消息出现在控制台日志中的每个测试用例之后.
我目前正在使用:
- Chrome驱动程序v88
- Google Chrome 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
是否有禁用此日志消息的选项?
根据您链接的答案,这就是您所需要的:
*** Settings ***
Library SeleniumLibrary
*** Test Cases ***
Silent Chrome
Open Browser https://whosebug.com Chrome options=add_experimental_option("excludeSwitches", ["enable-logging"])
来自 Open Browser
关键字的文档:
The string format allows defining Selenium options methods or attributes and their arguments in Robot Framework test data. The method and attributes names are case and space sensitive and must match to the Selenium options methods and attributes names. When defining a method, it must be defined in a similar way as in python: method name, opening parenthesis, zero to many arguments and closing parenthesis. If there is a need to define multiple arguments for a single method, arguments must be separated with comma, just like in Python. Example:
add_argument("--headless")
oradd_experimental_option("key", "value")
.