本文整理汇总了Java中org.openqa.selenium.remote.CommandExecutor类的典型用法代码示例。如果您正苦于以下问题:Java CommandExecutor类的具体用法?Java CommandExecutor怎么用?Java CommandExecutor使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
CommandExecutor类属于org.openqa.selenium.remote包,在下文中一共展示了CommandExecutor类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: enrichRemoteWebDriverToInteractDirectlyWithNode
import org.openqa.selenium.remote.CommandExecutor; //导入依赖的package包/类
/**
* A helper method that enriches a {@link RemoteWebDriver} instance with the ability to route all browser
* interaction requests directly to the node on which the session was created and route only the session termination
* request to the hub.
*
* @param driver - A {@link RemoteWebDriver} instance.
* @param hub - A {@link Host} object that represents the Hub information.
* @return - A {@link RemoteWebDriver} instance that is enriched with the ability to route all browser interactions
* directly to the node.
*/
public static RemoteWebDriver enrichRemoteWebDriverToInteractDirectlyWithNode(RemoteWebDriver driver, Host hub) {
if (hub == null) {
return driver;
}
try {
CommandExecutor grid = driver.getCommandExecutor();
String sessionId = driver.getSessionId().toString();
GridApiAssistant assistant = new GridApiAssistant(hub);
Host nodeHost = assistant.getNodeDetailsForSession(sessionId);
URL url = new URL(String.format("http://%s:%d/wd/hub", nodeHost.getIpAddress(), nodeHost.getPort()));
CommandExecutor node = new HttpCommandExecutor(url);
CommandCodec commandCodec = getCodec(grid, "commandCodec");
ResponseCodec responseCodec = getCodec(grid, "responseCodec");
setCodec(node, commandCodec, "commandCodec");
setCodec(node, responseCodec, "responseCodec");
appendListenerToWebDriver(driver, grid, node);
LOG.info("Traffic will now be routed directly to the node.");
LOG.warning(constructWarningMessage(hub));
} catch (Exception e) {
//Gobble exceptions
LOG.warning("Unable to enrich the RemoteWebDriver instance. Root cause :" + e.getMessage()
+ ". Returning back the original instance that was passed, as is.");
}
return driver;
}
开发者ID:RationaleEmotions,项目名称:talk2grid,代码行数:37,代码来源:RemoteWebDriverEnricher.java
示例2: getHubInfo
import org.openqa.selenium.remote.CommandExecutor; //导入依赖的package包/类
private static Host getHubInfo(RemoteWebDriver driver) {
Host hub = null;
CommandExecutor executor = driver.getCommandExecutor();
if (executor instanceof HttpCommandExecutor) {
URL url = ((HttpCommandExecutor) executor).getAddressOfRemoteServer();
hub = new Host(url.getHost(), Integer.toString(url.getPort()));
}
return hub;
}
开发者ID:RationaleEmotions,项目名称:talk2grid,代码行数:10,代码来源:RemoteWebDriverEnricher.java
示例3: getCodec
import org.openqa.selenium.remote.CommandExecutor; //导入依赖的package包/类
@SuppressWarnings("unchecked")
private static <T> T getCodec(CommandExecutor executor, String fieldName) throws Exception {
Class clazz = executor.getClass();
Field field = clazz.getDeclaredField(fieldName);
field.setAccessible(true);
return (T) field.get(executor);
}
开发者ID:RationaleEmotions,项目名称:talk2grid,代码行数:8,代码来源:RemoteWebDriverEnricher.java
示例4: appendListenerToWebDriver
import org.openqa.selenium.remote.CommandExecutor; //导入依赖的package包/类
@SuppressWarnings("unchecked")
private static void appendListenerToWebDriver(RemoteWebDriver rwd, CommandExecutor grid, CommandExecutor node)
throws NoSuchMethodException, InvocationTargetException, IllegalAccessException {
CommandExecutor executor = new CustomCommandExecutor(grid, node);
Class clazz = rwd.getClass();
while (!RemoteWebDriver.class.equals(clazz)) {
clazz = clazz.getSuperclass();
}
Method m = clazz.getDeclaredMethod("setCommandExecutor", CommandExecutor.class);
m.setAccessible(true);
m.invoke(rwd, executor);
}
开发者ID:RationaleEmotions,项目名称:talk2grid,代码行数:13,代码来源:RemoteWebDriverEnricher.java
示例5: getDriver
import org.openqa.selenium.remote.CommandExecutor; //导入依赖的package包/类
public UiDriver getDriver(WebDriverCommandLogger cmdLogger, String[] stb) {
String browser = STBArgs.browser_str.getFrom(stb);
String baseUrl = STBArgs.base_url.getFrom(stb);
QAFCommandProcessor commandProcessor =
new SeleniumCommandProcessor(STBArgs.sel_server.getFrom(stb),
Integer.parseInt(STBArgs.port.getFrom(stb)),
browser.split("_")[0], baseUrl);
CommandExecutor executor = getObject(commandProcessor);
QAFExtendedWebDriver driver =
new QAFExtendedWebDriver(executor, new DesiredCapabilities(), cmdLogger);
QAFWebDriverBackedSelenium selenium =
new QAFWebDriverBackedSelenium(commandProcessor, driver);
commandProcessor.addListener(new SubmitCommandListener());
commandProcessor.addListener(new SeleniumCommandLogger(new ArrayList<LoggingBean>()));
commandProcessor.addListener(new AutoWaitInjector());
if (browser.contains("iexproper") || browser.contains("iehta")) {
commandProcessor.addListener(new IEScreenCaptureListener());
}
String listners = ApplicationProperties.SELENIUM_CMD_LISTENERS.getStringVal("");
if (!listners.equalsIgnoreCase("")) {
commandProcessor.addListener(listners.split(","));
}
return selenium;
}
开发者ID:qmetry,项目名称:qaf,代码行数:30,代码来源:SeleniumDriverFactory.java
示例6: getObject
import org.openqa.selenium.remote.CommandExecutor; //导入依赖的package包/类
private CommandExecutor getObject(Object commandProcessor) {
try {
Class<?> clazz = Class.forName("org.openqa.selenium.SeleneseCommandExecutor");
Class<?> commandProcessorclazz =
Class.forName("com.thoughtworks.selenium.CommandProcessor");
Constructor<?> ctor = clazz.getConstructor(commandProcessorclazz);
return (CommandExecutor) ctor.newInstance(new Object[]{commandProcessor});
} catch (Exception e) {
throw new RuntimeException(e.getMessage()
+ "SeleneseCommandExecutor is not available. Please try with selenium 2.32 or older.");
}
}
开发者ID:qmetry,项目名称:qaf,代码行数:14,代码来源:SeleniumDriverFactory.java
示例7: SelendroidDriver
import org.openqa.selenium.remote.CommandExecutor; //导入依赖的package包/类
private SelendroidDriver(CommandExecutor executor, Capabilities caps) throws Exception {
super(executor, caps);
RemoteExecuteMethod executeMethod = new RemoteExecuteMethod(this);
touchScreen = new RemoteTouchScreen(executeMethod);
multiTouchScreen = new MultiTouchScreen(executeMethod);
adbConnection = new RemoteAdbConnection(executeMethod);
trackBall = new TrackBall(executeMethod);
}
开发者ID:selendroid,项目名称:selendroid,代码行数:9,代码来源:SelendroidDriver.java
示例8: WebDriverEx
import org.openqa.selenium.remote.CommandExecutor; //导入依赖的package包/类
public WebDriverEx(CommandExecutor executor, Capabilities desiredCapabilities, Capabilities requiredCapabilities) {
super(executor, desiredCapabilities, requiredCapabilities);
}
开发者ID:brucezee,项目名称:jspider,代码行数:4,代码来源:WebDriverEx.java
示例9: setCodec
import org.openqa.selenium.remote.CommandExecutor; //导入依赖的package包/类
private static <T> void setCodec(CommandExecutor executor, T codec, String fieldName) throws Exception {
Class clazz = executor.getClass();
Field field = clazz.getDeclaredField(fieldName);
field.setAccessible(true);
field.set(executor, codec);
}
开发者ID:RationaleEmotions,项目名称:talk2grid,代码行数:7,代码来源:RemoteWebDriverEnricher.java
示例10: CustomCommandExecutor
import org.openqa.selenium.remote.CommandExecutor; //导入依赖的package包/类
CustomCommandExecutor(CommandExecutor grid, CommandExecutor node) {
this.grid = grid;
this.node = node;
}
开发者ID:RationaleEmotions,项目名称:talk2grid,代码行数:5,代码来源:CustomCommandExecutor.java
示例11: WebDriverRemote
import org.openqa.selenium.remote.CommandExecutor; //导入依赖的package包/类
public WebDriverRemote(CommandExecutor executor, Capabilities capabilities) {
super(executor, capabilities);
}
开发者ID:Nonorc,项目名称:saladium,代码行数:4,代码来源:WebDriverRemote.java
示例12: DefaultGenericMobileDriver
import org.openqa.selenium.remote.CommandExecutor; //导入依赖的package包/类
public DefaultGenericMobileDriver(CommandExecutor executor, Capabilities desiredCapabilities) {
super(executor, desiredCapabilities);
}
开发者ID:JoeUtt,项目名称:menggeqa,代码行数:4,代码来源:DefaultGenericMobileDriver.java
示例13: QAFExtendedWebDriver
import org.openqa.selenium.remote.CommandExecutor; //导入依赖的package包/类
public QAFExtendedWebDriver(CommandExecutor cmdExecutor, Capabilities capabilities,
WebDriverCommandLogger reporter) {
super(cmdExecutor, capabilities);
init(reporter);
}
开发者ID:qmetry,项目名称:qaf,代码行数:6,代码来源:QAFExtendedWebDriver.java
示例14: xRemoteWebDriver
import org.openqa.selenium.remote.CommandExecutor; //导入依赖的package包/类
public xRemoteWebDriver(CommandExecutor executor, Capabilities desiredCapabilities,Log log)
{
super(executor, desiredCapabilities);
}
开发者ID:selenium-webdriver-software-testing,项目名称:kspl-selenium-helper,代码行数:5,代码来源:xRemoteWebDriver.java
注:本文中的org.openqa.selenium.remote.CommandExecutor类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论