当前位置: 动力学知识库 > 问答 > 编程问答 >

java - How to get Test Activity Logs from Selenium Grid 2 programatically?

问题描述:

I am trying to launch Selenium Grid2 programatically, and I also know that Grid API has a LoggerManager. But I am not sure how to implement a custom logger for it or get the selenium node logs at the Gird Hub end.

Either,

I need a way to get Selenium Grid 2 Node logs as part of Selenium Hub

logs

or

I need a way to get all test activity logged at Selenium Hub end

By test activity I mean activity log of all the calls to JsonWire rest service and responses

.

How can this be done?

I am running Selenium Grid using following code

import org.openqa.grid.web.Hub;

import org.openqa.grid.internal.utils.GridHubConfiguration;

public class GridHub {

private String host = "localhost";

private Integer port = 4444;

Hub gridHub = null;

GridHubConfiguration gridHubConfig = new GridHubConfiguration();

GridHub() {

gridHubConfig.setHost(host);

gridHubConfig.setPort(port);

gridHub = new Hub(gridHubConfig);

gridHub.start();

}

}

网友答案:

SeleniumDriverResourceHandler.java contains a getLog command which might help.

So from the HUB, you'd send a http://node/selenium-server/driver?cmd=getLog or getLogMessages to the node, which will return the logs for the current session (LoggingManager.perSessionLogHandler().getLog(sessionId))

At this point you have access to the node's log on the hub.

Hope this helps?

分享给朋友:
您可能感兴趣的文章:
随机阅读: