com.atlassian.webdriver.utils
Class JavaScriptUtils

java.lang.Object
  extended by com.atlassian.webdriver.utils.JavaScriptUtils

public class JavaScriptUtils
extends Object

JavaScript Utilities for executing specific javascript events.


Method Summary
static void dispatchEvent(String eventType, org.openqa.selenium.WebElement element, org.openqa.selenium.WebDriver webDriver)
           
static void dispatchMouseEvent(String event, org.openqa.selenium.WebElement el, org.openqa.selenium.WebDriver driver)
          Dispatches a javascript mouse event in the browser on a specified element
static
<T> T
execute(Class<T> expectedReturn, String js, org.openqa.selenium.WebDriver driver, Object... arguments)
           
static
<T> T
execute(String js, org.openqa.selenium.WebDriver driver, Object... arguments)
           
static String innerHtml(org.openqa.selenium.WebElement element, org.openqa.selenium.WebDriver driver)
          Deprecated. Use WebElementUtil.getInnerHtml(WebElement, WebDriver)
static boolean isScriptLoaded(String jsScriptName, org.openqa.selenium.WebDriver webDriver)
           
static boolean loadScript(String jsScriptName, org.openqa.selenium.WebDriver driver)
          Will load a javascript file from the class loader.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

innerHtml

@Deprecated
public static String innerHtml(org.openqa.selenium.WebElement element,
                                          org.openqa.selenium.WebDriver driver)
Deprecated. Use WebElementUtil.getInnerHtml(WebElement, WebDriver)


dispatchEvent

public static void dispatchEvent(String eventType,
                                 org.openqa.selenium.WebElement element,
                                 org.openqa.selenium.WebDriver webDriver)

dispatchMouseEvent

public static void dispatchMouseEvent(String event,
                                      org.openqa.selenium.WebElement el,
                                      org.openqa.selenium.WebDriver driver)
Dispatches a javascript mouse event in the browser on a specified element

Parameters:
event - The name of the event to dispatch. eg. load.
el - The element to fire the event on.
driver - the webdriver instance that executes the javascript event.

loadScript

public static boolean loadScript(String jsScriptName,
                                 org.openqa.selenium.WebDriver driver)
Will load a javascript file from the class loader.

Parameters:
jsScriptName - the name of the javascipt file
driver - the webdriver to execute the javascript
Returns:
true if the file was loaded. false if it was already loaded.

isScriptLoaded

public static boolean isScriptLoaded(String jsScriptName,
                                     org.openqa.selenium.WebDriver webDriver)

execute

public static <T> T execute(String js,
                            org.openqa.selenium.WebDriver driver,
                            Object... arguments)

execute

public static <T> T execute(Class<T> expectedReturn,
                            String js,
                            org.openqa.selenium.WebDriver driver,
                            Object... arguments)


Copyright © 2014 Atlassian. All rights reserved.