org.openqa.selenium
Interface JavascriptExecutor


public interface JavascriptExecutor

Indicates that a driver can execute Javascript, providing access to the mechanism to do so.


Method Summary
 java.lang.Object executeScript(java.lang.String script, java.lang.Object... args)
          Execute javascript in the context of the currently selected frame or window.
 boolean isJavascriptEnabled()
          It's not enough to simply support javascript, it also needs to be enabled too.
 

Method Detail

executeScript

java.lang.Object executeScript(java.lang.String script,
                               java.lang.Object... args)
Execute javascript in the context of the currently selected frame or window. This means that "document" will refer to the current document. If the script has a return value, then the following steps will be taken:

Arguments must be a number, a boolean, a String, WebElement, or a List of any combination of the above. An exception will be thrown if the arguments do not meet these criteria. The arguments will be made available to the javascript via the "arguments" magic variable, as if the function were called via "Function.apply"

Parameters:
script - The javascript to execute
args - The arguments to the script. May be empty
Returns:
One of Boolean, Long, String, List or WebElement. Or null.

isJavascriptEnabled

boolean isJavascriptEnabled()
It's not enough to simply support javascript, it also needs to be enabled too.



Copyright © 2009. All Rights Reserved.