本文整理汇总了Java中org.openqa.grid.common.GridRole类的典型用法代码示例。如果您正苦于以下问题:Java GridRole类的具体用法?Java GridRole怎么用?Java GridRole使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
GridRole类属于org.openqa.grid.common包,在下文中一共展示了GridRole类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getHubParms
import org.openqa.grid.common.GridRole; //导入依赖的package包/类
/**
* Assemble parameters object for the configured Selenium Grid hub.
*
* @param config WebDriver/Grid configuration
* @return Grid hub parameters object
*/
public static GridServerParms getHubParms(SeleniumConfig config) {
GridServerParms parms = new GridServerParms();
parms.processRole = GridRole.HUB;
parms.processArgs = config.getHubArgs();
parms.serverHost = GridUtility.getHubHost(config.getHubConfig());
try {
parms.endpointUrl = URI.create(parms.serverHost.toURI() + GRID_ENDPOINT).toURL();
parms.statusUrl = URI.create(parms.serverHost.toURI() + HUB_STATUS).toURL();
} catch (MalformedURLException e) {
throw new InvalidGridHostException("hub", parms.serverHost, e);
}
return parms;
}
示例2: getNodeParms
import org.openqa.grid.common.GridRole; //导入依赖的package包/类
/**
* Assemble parameters object for the configured Selenium Grid node.
*
* @param config WebDriver/Grid configuration
* @return Grid node parameters object
*/
public static GridServerParms getNodeParms(SeleniumConfig config) {
GridServerParms parms = new GridServerParms();
parms.processRole = GridRole.NODE;
parms.processArgs = config.getNodeArgs();
parms.serverHost = GridUtility.getNodeHost(config.getNodeConfig());
try {
parms.endpointUrl = URI.create(parms.serverHost.toURI() + GRID_ENDPOINT).toURL();
parms.statusUrl = URI.create(parms.serverHost.toURI() + NODE_STATUS).toURL();
} catch (MalformedURLException e) {
throw new InvalidGridHostException("node", parms.serverHost, e);
}
return parms;
}
示例3: testNodeConfig
import org.openqa.grid.common.GridRole; //导入依赖的package包/类
@Test
public void testNodeConfig() {
SeleniumConfig config = SeleniumConfig.getConfig();
RegistrationRequest nodeConfig = config.getNodeConfig();
assertNotNull(nodeConfig);
assertEquals(nodeConfig.getConfiguration().get("role"), "node");
assertEquals(nodeConfig.getRole(), GridRole.NODE);
boolean hasPhantomJS = false;
for (DesiredCapabilities capability : nodeConfig.getCapabilities()) {
if ("phantomjs".equals(capability.getBrowserName())) {
hasPhantomJS = true;
break;
}
}
assertTrue(hasPhantomJS);
}
示例4: setProcess
import org.openqa.grid.common.GridRole; //导入依赖的package包/类
/**
* Store the specified Selenium Grid server process using the specified role.
*
* @param processRole Selenium Grid server role (either HUB or NODE)
* @param serverProcess Selenium Grid server process
*/
private static void setProcess(GridRole processRole, Process serverProcess) {
switch (processRole) {
case HUB:
setHubProcess(serverProcess);
break;
case NODE:
setNodeProcess(serverProcess);
break;
default:
throw new IllegalArgumentException();
}
}