com.atlassian.confluence.pageobjects
Class WebdriverUtils

java.lang.Object
  extended by com.atlassian.confluence.pageobjects.WebdriverUtils

public class WebdriverUtils
extends Object

A utility class for webdriver tests.


Constructor Summary
WebdriverUtils(com.atlassian.pageobjects.elements.PageElementFinder pageElementFinder, org.openqa.selenium.JavascriptExecutor executor, com.atlassian.pageobjects.elements.timeout.Timeouts timeouts, com.atlassian.webdriver.waiter.Waiter waiter)
           
 
Method Summary
 String getMetadata(String name)
          Returns the meta tag's content.
 long getMetadataLong(String name)
           
 Long getPageRequestTime()
          Returns the confluence request time served in the page's meta tag Note: this is done via javascript as the page can change during the time the elements are read
 void waitForNoPageReload(com.atlassian.pageobjects.elements.PageElement elementToClick)
           
 void waitForPageChange(com.atlassian.pageobjects.elements.PageElement elementToClick)
          This method is useful when a new page is loaded via javascript.
 void waitForPageChange(Runnable r)
          Ensures that after running the given Runnable that the page did reload.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WebdriverUtils

@Inject
public WebdriverUtils(com.atlassian.pageobjects.elements.PageElementFinder pageElementFinder,
                             org.openqa.selenium.JavascriptExecutor executor,
                             com.atlassian.pageobjects.elements.timeout.Timeouts timeouts,
                             com.atlassian.webdriver.waiter.Waiter waiter)
Method Detail

waitForPageChange

public void waitForPageChange(Runnable r)
Ensures that after running the given Runnable that the page did reload.

Parameters:
r - a runnable that will perform some action that should cause a page reload.
See Also:
for {@link #waitForPageChange(com.atlassian.pageobjects.elements.PageElement)}.

waitForPageChange

public void waitForPageChange(com.atlassian.pageobjects.elements.PageElement elementToClick)
This method is useful when a new page is loaded via javascript. e.g. when the Create button in the blueprint dialogs is clicked and the newly created page/space is loaded. This implementation is a little hacky but the best solution at the time of writing.

Parameters:
elementToClick - the element to click before waiting for the page to change

waitForNoPageReload

public void waitForNoPageReload(com.atlassian.pageobjects.elements.PageElement elementToClick)

getPageRequestTime

public Long getPageRequestTime()
Returns the confluence request time served in the page's meta tag Note: this is done via javascript as the page can change during the time the elements are read


getMetadata

public String getMetadata(String name)
Returns the meta tag's content. Note that you do not have to pass the "ajs-" prefix to the name, this is done for you.

Parameters:
name - name of the meta tag, excluding the ajs- prefix
Returns:
the content in the meta tag

getMetadataLong

public long getMetadataLong(String name)


Copyright © 2003–2015 Atlassian. All rights reserved.