org.jboss.test.selenium.waiting.ajax
Class AjaxWaiting

java.lang.Object
  extended by org.jboss.test.selenium.waiting.DefaultWaiting<AjaxWaiting>
      extended by org.jboss.test.selenium.waiting.ajax.AjaxWaiting
All Implemented Interfaces:
Cloneable, Waiting<AjaxWaiting>

public class AjaxWaiting
extends DefaultWaiting<AjaxWaiting>

Implementation of waiting for satisfaction of conditions on page after the Ajax request.

It uses custom JavaScript and com.thoughtworks.selenium.Selenium.Selenium#waitForCondition(String, String) to wait for satisfying given condition.

Version:
$Revision$
Author:
Lukas Fryc

Constructor Summary
AjaxWaiting()
           
 
Method Summary
 void until(JavaScriptCondition condition)
          Stars loop waiting to satisfy condition.
<T> void
waitForChange(JavaScriptRetriever<T> retriever)
           Waits until Retrieve's implementation doesn't retrieve value other than value stored by initialization in retriever.
<T> void
waitForChange(T oldValue, JavaScriptRetriever<T> retriever)
          Waits until Retrieve's implementation doesn't retrieve value other than oldValue.
<T> T
waitForChangeAndReturn(JavaScriptRetriever<T> retriever)
           Waits until Retrieve's implementation doesn't retrieve value other than value stored by initialization in retriever.
<T> T
waitForChangeAndReturn(T oldValue, JavaScriptRetriever<T> retriever)
          Waits until Retrieve's implementation doesn't retrieve value other than oldValue and this new value returns.
 
Methods inherited from class org.jboss.test.selenium.waiting.DefaultWaiting
dontFail, fail, failWith, failWith, getInterval, getTimeout, interval, isDelayed, noDelay, timeout, waitForTimeout, withDelay
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AjaxWaiting

public AjaxWaiting()
Method Detail

until

public void until(JavaScriptCondition condition)
Stars loop waiting to satisfy condition.

Parameters:
condition - what wait for to be satisfied

waitForChange

public <T> void waitForChange(T oldValue,
                              JavaScriptRetriever<T> retriever)
Waits until Retrieve's implementation doesn't retrieve value other than oldValue.

Type Parameters:
T - type of value what we are waiting for change
Parameters:
oldValue - value that we are waiting for change
retriever - implementation of retrieving actual value

waitForChange

public <T> void waitForChange(JavaScriptRetriever<T> retriever)

Waits until Retrieve's implementation doesn't retrieve value other than value stored by initialization in retriever.

After retrieving, new value will be associated with given Retriever.

Note that Retriever needs to be initialized first by one of methods Retriever#initializeValue() or Retriever#setValue(Object).

Type Parameters:
T - type of value what we are waiting for change
Parameters:
retriever - implementation of retrieving actual value

waitForChangeAndReturn

public <T> T waitForChangeAndReturn(T oldValue,
                                    JavaScriptRetriever<T> retriever)
Waits until Retrieve's implementation doesn't retrieve value other than oldValue and this new value returns.

Type Parameters:
T - type of value what we are waiting for change
Parameters:
oldValue - value that we are waiting for change
retriever - implementation of retrieving actual value
Returns:
new retrieved value

waitForChangeAndReturn

public <T> T waitForChangeAndReturn(JavaScriptRetriever<T> retriever)

Waits until Retrieve's implementation doesn't retrieve value other than value stored by initialization in retriever.

After retrieving, new value will be associated with given Retriever.

Note that Retriever needs to be initialized first by one of methods Retriever#initializeValue() or Retriever#setValue(Object).

Type Parameters:
T - type of value what we are waiting for change
Parameters:
retriever - implementation of retrieving actual value
Returns:
new retrieved value


Copyright © 2011 JBoss, a division of Red Hat, Inc.. All Rights Reserved.