org.openqa.selenium.remote.RemoteWebDriver#executeScript ( )源码实例Demo

下面列出了org.openqa.selenium.remote.RemoteWebDriver#executeScript ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: collect-earth   文件: BrowserService.java
private boolean loadPlotInDGMap(SimplePlacemarkObject placemarkObject, RemoteWebDriver driver)
		throws InterruptedException {

	boolean success = true;
	if (driver != null && waitFor("mainContent", driver) && driver instanceof JavascriptExecutor) {
		try {
			String dgmapJs = getDGMapJavascript(placemarkObject);
			driver.executeScript(dgmapJs);

			Thread.sleep( 1000 );
			// Unlock the view if it is locked
			if( isCssElementPresent(".lock.on",  driver)  ) {
				driver.findElementByCssSelector(".lock.on").click(); // UNLOCK
			}

		} catch (final Exception e) {
			processSeleniumError(e);
			success = false;
		}
	}
	return success;
}
 
源代码2 项目: xframium-java   文件: BrowserCacheLogic.java
private static boolean clickIfPresent( RemoteWebDriver driver, String xpath )
{
    boolean rtn = false;

    HashMap<String, Object> params = new HashMap();
    params.put("value", xpath);
    params.put("framework", "perfectoMobile");

    String result = (String) driver.executeScript("mobile:application.element:find", params);

    if (( result != null ) && ( !( "false".equalsIgnoreCase( result ) )))
    {
        //
        // This shouldn't be necessary, but I'm seeing the 'find' call finding
        // elements that are scrolled off of the screen/page.
        //
        
        try
        {
            driver.executeScript("mobile:application.element:click", params);

            rtn = true;
        }
        catch( Throwable e )
        {}
    }

    return rtn;
}
 
源代码3 项目: agent   文件: IosUtil.java
public static void uninstallApp(RemoteWebDriver driver, String bundleId) {
    driver.executeScript("mobile: removeApp", ImmutableMap.of("bundleId", bundleId));
}
 
源代码4 项目: agent   文件: IosUtil.java
public static void launchApp(RemoteWebDriver driver, String bundleId) {
    driver.executeScript("mobile: launchApp", ImmutableMap.of("bundleId", bundleId));
}
 
源代码5 项目: agent   文件: IosUtil.java
public static boolean terminateApp(RemoteWebDriver driver, String bundleId) {
    return (Boolean) driver.executeScript("mobile: terminateApp", ImmutableMap.of("bundleId", bundleId));
}
 
源代码6 项目: agent   文件: IosUtil.java
public static void pressHome(RemoteWebDriver driver) {
    driver.executeScript("mobile:pressButton", ImmutableMap.of("name", "home"));
}
 
源代码7 项目: adf-selenium   文件: AdfComponent.java
public static <T extends AdfComponent> T forElement(WebElement element) {
    RemoteWebElement rwe = (RemoteWebElement) element;
    RemoteWebDriver rwd = (RemoteWebDriver) rwe.getWrappedDriver();
    String clientid = (String) rwd.executeScript(JS_FIND_ANCESTOR_COMPONENT, element);
    return forClientId(rwd, clientid);
}