Selenium - 通过网格运行构建时,如何获取控制台输出?
我们已经通过本地 RC 运行 Selenium 测试几年了,并且开始迁移到网格。我们一直将服务器的控制台输出重定向到我们自己的测试日志。对于调试来说非常有用。控制台输出看起来很像 Log4J - 所以它应该是可重新配置的。
10:31:51.894 INFO - Command request: open[http://websiteundertest/IsSiteUpUp.aspx, ] on session 46c211b412474429957dbf6bebccd64d
10:31:55.323 INFO - Got result: OK on session 46c211b412474429957dbf6bebccd64d
10:31:56.330 INFO - Command request: isElementPresent[xpath=//h2, ] on session 46c211b412474429957dbf6bebccd64d
10:31:56.343 INFO - Got result: OK,true on session 46c211b412474429957dbf6bebccd64d
通过集线器重新运行时,控制台输出仅出现在远程 RC 上。简单的控制台重定向不起作用。在这个问题的范围内,我们需要在执行测试的计算机可以访问的地方捕获远程控制台输出。我们通过 C# 从多个构建代理运行测试。我们正在尝试网格 1 和 2。我们打算直接进入网格 2.x。
We've been running Selenium tests via local RC for a few years, and are starting to migrate to the grid. We have been redirecting the console output of the server to our own test logs. It is quite useful for debugging. The console output looks suspiciously like Log4J - so it should be reconfigurable.
10:31:51.894 INFO - Command request: open[http://websiteundertest/IsSiteUpUp.aspx, ] on session 46c211b412474429957dbf6bebccd64d
10:31:55.323 INFO - Got result: OK on session 46c211b412474429957dbf6bebccd64d
10:31:56.330 INFO - Command request: isElementPresent[xpath=//h2, ] on session 46c211b412474429957dbf6bebccd64d
10:31:56.343 INFO - Got result: OK,true on session 46c211b412474429957dbf6bebccd64d
When re run via the hub, the console output appears only on the remote RC. The simple console redirection won't work. In scope of this question, we need to capture the remote console output someplace where the computer executing the test can get to it. We run our tests from a number of build agents via C#. We are trying grid 1 and 2. We intend to go directly to Grid 2.x.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
他的意思是:这
不起作用。它将创建一个新文件,但它是空的。我建议使用
-log mylog.txt
启动节点或服务器存储日志文件时的参数
What he meant was that this:
does not work. It will create a new file but it will be empty. I suggest using
-log mylog.txt
argument when starting node or server to store log files
在最新版本的 Grid 中,您可以在启动每个客户端节点时重定向输出:
java -jar selenium-server-standalone-2.15.0.jar -role webdriver -hub http://127.0.0.1:4444/grid/register > mylog.txt
这是一个 Windows 示例。您还可以通过在重定向中引用
\\serverName\mylog.txt
将日志文件集中在某些远程服务器上。当你说:
我不确定我是否理解。
In the latest version of Grid, you can redirect the output when you start each of your client nodes:
java -jar selenium-server-standalone-2.15.0.jar -role webdriver -hub http://127.0.0.1:4444/grid/register > mylog.txt
This is a Windows example. You can also centralize log files on some remote server by referencing a
\\serverName\mylog.txt
in your redirect.When you say:
I'm not sure I understand.