com.atlassian.jira.webtest.framework.impl.selenium.util
Class JqueryExecutor

java.lang.Object
  extended by com.atlassian.jira.webtest.framework.impl.selenium.core.SeleniumContextAware
      extended by com.atlassian.jira.webtest.framework.impl.selenium.util.JqueryExecutor

public final class JqueryExecutor
extends SeleniumContextAware

Executes jQuery code in Selenium (given the current page has loaded a JQuery library).

Since:
v4.2

Nested Class Summary
static class JqueryExecutor.JqueryState
           
 
Field Summary
 
Fields inherited from class com.atlassian.jira.webtest.framework.impl.selenium.core.SeleniumContextAware
assertThat, client, context, timeouts
 
Constructor Summary
JqueryExecutor(SeleniumContext ctx)
           
 
Method Summary
 TimedCondition canExecute()
          Check, if jQuery code can be executed on the current web page.
 String checkJquery()
          Evaluate Jquery.
 TimedQuery<String> execute(String script)
          Execute given jQuery script in Selenium, first waiting for the condition that jQuery is defined on the tested page.
 String executeNow(String script)
          Execute script now without verifying if jQuery is defined in the current test context.
 TimedQuery<String> executeSafe(String script)
          Execute given jQuery script in Selenium, first waiting for the condition that jQuery is defined on the tested page.
 JqueryExecutor.JqueryState jqueryState()
          Check JQuery state in the current page.
 
Methods inherited from class com.atlassian.jira.webtest.framework.impl.selenium.core.SeleniumContextAware
context
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JqueryExecutor

public JqueryExecutor(SeleniumContext ctx)
Method Detail

canExecute

public TimedCondition canExecute()
Check, if jQuery code can be executed on the current web page. This boils down to making sure that the 'jQuery' function is present,

Returns:
true, if jQuery may be executed at the current page, false otherwise. If this method returns false, calling execute(String) may result in errors

jqueryState

public JqueryExecutor.JqueryState jqueryState()
Check JQuery state in the current page.

Returns:
current jQuery state
See Also:
JqueryExecutor.JqueryState

checkJquery

public String checkJquery()
Evaluate Jquery. Use for debugging weird Selenium cases, where Jquery is actually not a function.

Returns:
evaluation of jQuery variable in the current page.

execute

public TimedQuery<String> execute(String script)
Execute given jQuery script in Selenium, first waiting for the condition that jQuery is defined on the tested page.

Parameters:
script - pure jQuery script
Returns:
result of script evaluation
Throws:
IllegalStateException - if this script cannot be executed (jQuery not defined on the page before timeout)

executeSafe

public TimedQuery<String> executeSafe(String script)
Execute given jQuery script in Selenium, first waiting for the condition that jQuery is defined on the tested page. If this condition is not met before timeout, the resulting query will return null.

Parameters:
script - pure jQuery script
Returns:
timed query representing result of script evaluation

executeNow

public String executeNow(String script)
Execute script now without verifying if jQuery is defined in the current test context.

Parameters:
script - script to execute
Returns:
evaluation result


Copyright © 2002-2012 Atlassian. All Rights Reserved.