本文整理了Java中org.openqa.selenium.remote.RemoteWebDriver.execute
方法的一些代码示例,展示了RemoteWebDriver.execute
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。RemoteWebDriver.execute
方法的具体详情如下:
包路径:org.openqa.selenium.remote.RemoteWebDriver
类名称:RemoteWebDriver
方法名:execute
暂无
代码示例来源:origin: appium/java-client
@Override public Response execute(String driverCommand, Map<String, ?> parameters) {
return super.execute(driverCommand, parameters);
}
代码示例来源:origin: com.github.becauseQA/becauseQA-utils
@Override
public String getPageSource() {
if (getW3CStandardComplianceLevel() == 0) {
return (String) execute(DriverCommand.GET_PAGE_SOURCE).getValue();
}
String script = "var source = document.documentElement.outerHTML; \n"
+ "if (!source) { source = new XMLSerializer().serializeToString(document); }\n" + "return source;";
return (String) executeScript(script);
}
代码示例来源:origin: appium/java-client
@Override public Response execute(String command) {
return super.execute(command, ImmutableMap.of());
}
代码示例来源:origin: com.github.becauseQA/becauseQA-utils
public Timeouts setScriptTimeout(long time, TimeUnit unit) {
execute(DriverCommand.SET_TIMEOUT, ImmutableMap.of(
"type", "script",
"ms", TimeUnit.MILLISECONDS.convert(time, unit)));
return this;
}
代码示例来源:origin: com.github.becauseQA/becauseQA-utils
public WebDriver defaultContent() {
Map<String, Object> frameId = Maps.newHashMap();
frameId.put("id", null);
execute(DriverCommand.SWITCH_TO_FRAME, frameId);
return RemoteWebDriver.this;
}
代码示例来源:origin: com.github.becauseQA/becauseQA-utils
public Timeouts implicitlyWait(long time, TimeUnit unit) {
execute(DriverCommand.SET_TIMEOUT, ImmutableMap.of(
"type", "implicit",
"ms", TimeUnit.MILLISECONDS.convert(time, unit)));
return this;
}
代码示例来源:origin: com.github.becauseQA/becauseQA-utils
public Timeouts pageLoadTimeout(long time, TimeUnit unit) {
execute(DriverCommand.SET_TIMEOUT, ImmutableMap.of(
"type", "page load",
"ms", TimeUnit.MILLISECONDS.convert(time, unit)));
return this;
}
} // timeouts class.
代码示例来源:origin: com.github.becauseQA/becauseQA-utils
@SuppressWarnings("unchecked")
public List<String> getAvailableEngines() {
Response response = execute(DriverCommand.IME_GET_AVAILABLE_ENGINES);
return (List<String>) response.getValue();
}
代码示例来源:origin: org.seleniumhq.webdriver/webdriver-remote-client
@SuppressWarnings({"unchecked"})
public Set<String> getWindowHandles() {
Response response = execute("getWindowHandles");
List<String> returnedValues = (List<String>) response.getValue();
return new LinkedHashSet<String>(returnedValues);
}
代码示例来源:origin: com.github.becauseQA/becauseQA-utils
@Override
public String getTitle() {
Response response = execute(DriverCommand.GET_TITLE);
Object value = response.getValue();
return value == null ? "" : value.toString();
}
代码示例来源:origin: org.seleniumhq.webdriver/webdriver-remote-client
@SuppressWarnings({"unchecked"})
public Dimension getSize() {
Response response = parent.execute("getElementSize", map("id", id));
Map<String, Object> rawSize = (Map<String, Object>) response.getValue();
int width = ((Long) rawSize.get("width")).intValue();
int height = ((Long) rawSize.get("height")).intValue();
return new Dimension(width, height);
}
代码示例来源:origin: org.seleniumhq.webdriver/webdriver-remote-client
@SuppressWarnings({"unchecked"})
public Point getLocation() {
Response response = parent.execute("getElementLocation", map("id", id));
Map<String, Object> rawPoint = (Map<String, Object>) response.getValue();
int x = ((Long) rawPoint.get("x")).intValue();
int y = ((Long) rawPoint.get("y")).intValue();
return new Point(x, y);
}
代码示例来源:origin: com.github.becauseQA/becauseQA-utils
@SuppressWarnings({"unchecked"})
public Dimension getSize() {
Response response = execute(DriverCommand.GET_CURRENT_WINDOW_SIZE);
Map<String, Object> rawSize = (Map<String, Object>) response.getValue();
int width = ((Number) rawSize.get("width")).intValue();
int height = ((Number) rawSize.get("height")).intValue();
return new Dimension(width, height);
}
代码示例来源:origin: com.github.becauseQA/becauseQA-utils
@Override
public Object executeAsyncScript(String script, Object... args) {
if (!isJavascriptEnabled()) {
throw new UnsupportedOperationException(
"You must be using an underlying instance of " + "WebDriver that supports executing javascript");
}
// Escape the quote marks
script = script.replaceAll("\"", "\\\"");
Iterable<Object> convertedArgs = Iterables.transform(Lists.newArrayList(args), new WebElementToJsonConverter());
Map<String, ?> params = ImmutableMap.of("script", script, "args", Lists.newArrayList(convertedArgs));
return execute(DriverCommand.EXECUTE_ASYNC_SCRIPT, params).getValue();
}
代码示例来源:origin: com.github.becauseQA/becauseQA-utils
@Override
public Object executeScript(String script, Object... args) {
if (!capabilities.isJavascriptEnabled()) {
throw new UnsupportedOperationException(
"You must be using an underlying instance of WebDriver that supports executing javascript");
}
// Escape the quote marks
script = script.replaceAll("\"", "\\\"");
Iterable<Object> convertedArgs = Iterables.transform(Lists.newArrayList(args), new WebElementToJsonConverter());
Map<String, ?> params = ImmutableMap.of("script", script, "args", Lists.newArrayList(convertedArgs));
return execute(DriverCommand.EXECUTE_SCRIPT, params).getValue();
}
代码示例来源:origin: com.github.becauseQA/becauseQA-utils
@Override
@SuppressWarnings({ "unchecked" })
public Set<String> getWindowHandles() {
Response response = execute(DriverCommand.GET_WINDOW_HANDLES);
Object value = response.getValue();
try {
List<String> returnedValues = (List<String>) value;
return new LinkedHashSet<>(returnedValues);
} catch (ClassCastException ex) {
throw new WebDriverException("Returned value cannot be converted to List<String>: " + value, ex);
}
}
代码示例来源:origin: com.github.becauseQA/becauseQA-utils
public WebDriver frame(WebElement frameElement) {
Object elementAsJson = new WebElementToJsonConverter().apply(frameElement);
execute(DriverCommand.SWITCH_TO_FRAME, ImmutableMap.of("id", elementAsJson));
return RemoteWebDriver.this;
}
代码示例来源:origin: org.seleniumhq.webdriver/webdriver-remote-client
public String getValueOfCssProperty(String propertyName) {
Response response = parent.execute("getValueOfCssProperty", map("id", id, "propertyName", propertyName));
return (String) response.getValue();
}
}
代码示例来源:origin: com.github.becauseQA/becauseQA-utils
@Beta
public void setCredentials(Credentials credentials) {
if (!(credentials instanceof UserAndPassword)) {
throw new RuntimeException("Unsupported credentials: " + credentials);
}
UserAndPassword userAndPassword = (UserAndPassword) credentials;
execute(
DriverCommand.SET_ALERT_CREDENTIALS,
ImmutableMap.of(
"username", userAndPassword.getUsername(),
"password", userAndPassword.getPassword()));
}
代码示例来源:origin: com.github.becauseQA/becauseQA-utils
@Override
public String getCurrentUrl() {
Response response = execute(DriverCommand.GET_CURRENT_URL);
if (response == null || response.getValue() == null) {
throw new WebDriverException("Remote browser did not respond to getCurrentUrl");
}
return response.getValue().toString();
}
内容来源于网络,如有侵权,请联系作者删除!