Java 类org.openqa.selenium.remote.internal.WebElementToJsonConverter 实例源码

项目:qaf    文件:QAFExtendedWebDriver.java   
@Override
public Object executeScript(String script, Object... args) {
    if (!getCapabilities().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();
}
项目:qaf    文件:QAFExtendedWebDriver.java   
@Override
public Object executeAsyncScript(String script, Object... args) {
    if (!getCapabilities().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();
}
项目:qaf    文件:LiveIsExtendedWebDriver.java   
private Map<String, ?> validateScriptCommand(String script, Object... args) {
    if (!(isJavaScriptEnabled())) {
        throw new UnsupportedOperationException(
                "You must be using an underlying instance of WebDriver that supports executing javascript");
    }

    script = script.replaceAll("\"", "\\\"");
    Iterable<?> convertedArgs = Iterables.transform(Lists.newArrayList(args), new WebElementToJsonConverter());
    Map<String, ?> params = ImmutableMap.of("script", script, "args", Lists.newArrayList(convertedArgs));
    return params;
}