com.atlassian.webdriver
Class DefaultAtlassianWebDriver

java.lang.Object
  extended by com.atlassian.webdriver.DefaultAtlassianWebDriver
All Implemented Interfaces:
BrowserAware, AtlassianWebDriver, org.openqa.selenium.interactions.HasInputDevices, org.openqa.selenium.internal.WrapsDriver, org.openqa.selenium.JavascriptExecutor, org.openqa.selenium.SearchContext, org.openqa.selenium.WebDriver

public class DefaultAtlassianWebDriver
extends Object
implements AtlassianWebDriver

Exposes a set of common functions to use.


Nested Class Summary
 
Nested classes/interfaces inherited from interface org.openqa.selenium.WebDriver
org.openqa.selenium.WebDriver.ImeHandler, org.openqa.selenium.WebDriver.Navigation, org.openqa.selenium.WebDriver.Options, org.openqa.selenium.WebDriver.TargetLocator, org.openqa.selenium.WebDriver.Timeouts, org.openqa.selenium.WebDriver.Window
 
Constructor Summary
DefaultAtlassianWebDriver(org.openqa.selenium.WebDriver driver, Browser browser)
           
 
Method Summary
 void close()
           
 void dumpSourceTo(File dumpFile)
          Writes the source of the last loaded page to the specified file.
 boolean elementExists(org.openqa.selenium.By locator)
          Whether an element is present on the page.
 boolean elementExistsAt(org.openqa.selenium.By locator, org.openqa.selenium.SearchContext context)
          Whether an element is present within a search context.
 boolean elementIsVisible(org.openqa.selenium.By locator)
          Whether an element is visible on the page.
 boolean elementIsVisibleAt(org.openqa.selenium.By locator, org.openqa.selenium.SearchContext context)
          Whether an element is visible within a given search context.
 Object executeAsyncScript(String s, Object... objects)
           
 Object executeScript(String script)
           
 Object executeScript(String script, Object... args)
           
 org.openqa.selenium.WebElement findElement(org.openqa.selenium.By by)
           
 List<org.openqa.selenium.WebElement> findElements(org.openqa.selenium.By by)
           
 void get(String url)
          WebDriver implementation below
 Browser getBrowser()
          Get browser associated with this component.
 String getCurrentUrl()
           
 org.openqa.selenium.WebDriver getDriver()
          Gets the underlying WebDriver.
 org.openqa.selenium.interactions.Keyboard getKeyboard()
           
 org.openqa.selenium.interactions.Mouse getMouse()
           
 String getPageSource()
           
 String getTitle()
           
 String getWindowHandle()
           
 Set<String> getWindowHandles()
           
 org.openqa.selenium.WebDriver getWrappedDriver()
           
 boolean isJavascriptEnabled()
           
 org.openqa.selenium.WebDriver.Options manage()
           
 org.openqa.selenium.WebDriver.Navigation navigate()
           
 void quit()
          Quits this driver, closing every associated window.
 org.openqa.selenium.WebDriver.TargetLocator switchTo()
           
 void takeScreenshotTo(File destFile)
          Saves screen shot of the browser to the specified file.
 void waitUntil(com.google.common.base.Function<org.openqa.selenium.WebDriver,Boolean> isTrue)
          Waits for condition to evaluate to true until default timeout.
 void waitUntil(com.google.common.base.Function<org.openqa.selenium.WebDriver,Boolean> isTrue, int timeoutInSeconds)
          Waits for condition to evaluate to true until given timeout.
 void waitUntilElementIsLocated(org.openqa.selenium.By elementLocator)
          Wait until element is present on the page.
 void waitUntilElementIsLocatedAt(org.openqa.selenium.By elementLocator, org.openqa.selenium.SearchContext at)
          Wait until element is present within a search context.
 void waitUntilElementIsNotLocated(org.openqa.selenium.By elementLocator)
          Wait until element is not present on the page.
 void waitUntilElementIsNotLocatedAt(org.openqa.selenium.By elementLocator, org.openqa.selenium.SearchContext at)
          Wait until element is not present within a search context.
 void waitUntilElementIsNotVisible(org.openqa.selenium.By elementLocator)
          Wait until element is not visible on the page.
 void waitUntilElementIsNotVisibleAt(org.openqa.selenium.By elementLocator, org.openqa.selenium.SearchContext at)
          Wait until element is not visible within a search context.
 void waitUntilElementIsVisible(org.openqa.selenium.By elementLocator)
          Wait until element is visible on the page.
 void waitUntilElementIsVisibleAt(org.openqa.selenium.By elementLocator, org.openqa.selenium.SearchContext at)
          Wait until element is visible within search context.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultAtlassianWebDriver

@Inject
public DefaultAtlassianWebDriver(org.openqa.selenium.WebDriver driver,
                                        Browser browser)
Method Detail

getBrowser

public Browser getBrowser()
Description copied from interface: BrowserAware
Get browser associated with this component.

Specified by:
getBrowser in interface BrowserAware
Returns:
browser

getWrappedDriver

public org.openqa.selenium.WebDriver getWrappedDriver()
Specified by:
getWrappedDriver in interface org.openqa.selenium.internal.WrapsDriver

getDriver

public org.openqa.selenium.WebDriver getDriver()
Description copied from interface: AtlassianWebDriver
Gets the underlying WebDriver.

Specified by:
getDriver in interface AtlassianWebDriver
Returns:
WebDriver

quit

public void quit()
Description copied from interface: AtlassianWebDriver
Quits this driver, closing every associated window.

Specified by:
quit in interface AtlassianWebDriver
Specified by:
quit in interface org.openqa.selenium.WebDriver

waitUntil

public void waitUntil(com.google.common.base.Function<org.openqa.selenium.WebDriver,Boolean> isTrue)
Description copied from interface: AtlassianWebDriver
Waits for condition to evaluate to true until default timeout.

If the condition does not become true within default timeout, this method will throw a TimeoutException.

Specified by:
waitUntil in interface AtlassianWebDriver
Parameters:
isTrue - Function that evaluates true if waiting is complete.

waitUntil

public void waitUntil(com.google.common.base.Function<org.openqa.selenium.WebDriver,Boolean> isTrue,
                      int timeoutInSeconds)
Description copied from interface: AtlassianWebDriver
Waits for condition to evaluate to true until given timeout.

If the condition does not become true within given timeout, this method will throw a TimeoutException.

Specified by:
waitUntil in interface AtlassianWebDriver
Parameters:
isTrue - Function that evaluates true if waiting is complete.
timeoutInSeconds - Timeout in seconds to wait for condition to return true.

dumpSourceTo

public void dumpSourceTo(File dumpFile)
Description copied from interface: AtlassianWebDriver
Writes the source of the last loaded page to the specified file.

Specified by:
dumpSourceTo in interface AtlassianWebDriver
Parameters:
dumpFile - File to write the source to.

takeScreenshotTo

public void takeScreenshotTo(File destFile)
Description copied from interface: AtlassianWebDriver
Saves screen shot of the browser to the specified file.

Specified by:
takeScreenshotTo in interface AtlassianWebDriver
Parameters:
destFile - File to save screen shot.

waitUntilElementIsVisibleAt

public void waitUntilElementIsVisibleAt(org.openqa.selenium.By elementLocator,
                                        org.openqa.selenium.SearchContext at)
Description copied from interface: AtlassianWebDriver
Wait until element is visible within search context.

Specified by:
waitUntilElementIsVisibleAt in interface AtlassianWebDriver
Parameters:
elementLocator - Locator strategy for the element.
at - SearchContext to use when locating.

waitUntilElementIsVisible

public void waitUntilElementIsVisible(org.openqa.selenium.By elementLocator)
Description copied from interface: AtlassianWebDriver
Wait until element is visible on the page.

Specified by:
waitUntilElementIsVisible in interface AtlassianWebDriver
Parameters:
elementLocator - Locator strategy for the element.

waitUntilElementIsNotVisibleAt

public void waitUntilElementIsNotVisibleAt(org.openqa.selenium.By elementLocator,
                                           org.openqa.selenium.SearchContext at)
Description copied from interface: AtlassianWebDriver
Wait until element is not visible within a search context.

Specified by:
waitUntilElementIsNotVisibleAt in interface AtlassianWebDriver
Parameters:
elementLocator - Locator strategy for the element.
at - SearchContext to use when locating.

waitUntilElementIsNotVisible

public void waitUntilElementIsNotVisible(org.openqa.selenium.By elementLocator)
Description copied from interface: AtlassianWebDriver
Wait until element is not visible on the page.

Specified by:
waitUntilElementIsNotVisible in interface AtlassianWebDriver
Parameters:
elementLocator - Locator strategy for the element.

waitUntilElementIsLocatedAt

public void waitUntilElementIsLocatedAt(org.openqa.selenium.By elementLocator,
                                        org.openqa.selenium.SearchContext at)
Description copied from interface: AtlassianWebDriver
Wait until element is present within a search context.

Specified by:
waitUntilElementIsLocatedAt in interface AtlassianWebDriver
Parameters:
elementLocator - Locator strategy for the element.
at - SearchContext to use when locating.

waitUntilElementIsLocated

public void waitUntilElementIsLocated(org.openqa.selenium.By elementLocator)
Description copied from interface: AtlassianWebDriver
Wait until element is present on the page.

Specified by:
waitUntilElementIsLocated in interface AtlassianWebDriver
Parameters:
elementLocator - Locator strategy for the element.

waitUntilElementIsNotLocatedAt

public void waitUntilElementIsNotLocatedAt(org.openqa.selenium.By elementLocator,
                                           org.openqa.selenium.SearchContext at)
Description copied from interface: AtlassianWebDriver
Wait until element is not present within a search context.

Specified by:
waitUntilElementIsNotLocatedAt in interface AtlassianWebDriver
Parameters:
elementLocator - Locator strategy for the element.
at - Parent element to use when locating.

waitUntilElementIsNotLocated

public void waitUntilElementIsNotLocated(org.openqa.selenium.By elementLocator)
Description copied from interface: AtlassianWebDriver
Wait until element is not present on the page.

Specified by:
waitUntilElementIsNotLocated in interface AtlassianWebDriver
Parameters:
elementLocator - Locator strategy for the element.

elementExists

public boolean elementExists(org.openqa.selenium.By locator)
Description copied from interface: AtlassianWebDriver
Whether an element is present on the page.

Specified by:
elementExists in interface AtlassianWebDriver
Parameters:
locator - Locator strategy for the element.
Returns:
True if the element is present, false otherwise.

elementExistsAt

public boolean elementExistsAt(org.openqa.selenium.By locator,
                               org.openqa.selenium.SearchContext context)
Description copied from interface: AtlassianWebDriver
Whether an element is present within a search context.

Specified by:
elementExistsAt in interface AtlassianWebDriver
Parameters:
locator - Locator strategy for the element.
context - SearchContext to use when locating.
Returns:
True if element is present, false otherwise.

elementIsVisible

public boolean elementIsVisible(org.openqa.selenium.By locator)
Description copied from interface: AtlassianWebDriver
Whether an element is visible on the page.

Specified by:
elementIsVisible in interface AtlassianWebDriver
Parameters:
locator - Locator strategy for the element.
Returns:
True if element is visible, false otherwise

elementIsVisibleAt

public boolean elementIsVisibleAt(org.openqa.selenium.By locator,
                                  org.openqa.selenium.SearchContext context)
Description copied from interface: AtlassianWebDriver
Whether an element is visible within a given search context.

Specified by:
elementIsVisibleAt in interface AtlassianWebDriver
Parameters:
locator - Locator strategy for the element.
context - SearchContext to use when locating.
Returns:
True if element is visible, false otherwise

get

public void get(String url)
WebDriver implementation below

Specified by:
get in interface org.openqa.selenium.WebDriver

getCurrentUrl

public String getCurrentUrl()
Specified by:
getCurrentUrl in interface org.openqa.selenium.WebDriver

getTitle

public String getTitle()
Specified by:
getTitle in interface org.openqa.selenium.WebDriver

findElements

public List<org.openqa.selenium.WebElement> findElements(org.openqa.selenium.By by)
Specified by:
findElements in interface org.openqa.selenium.SearchContext
Specified by:
findElements in interface org.openqa.selenium.WebDriver

findElement

public org.openqa.selenium.WebElement findElement(org.openqa.selenium.By by)
Specified by:
findElement in interface org.openqa.selenium.SearchContext
Specified by:
findElement in interface org.openqa.selenium.WebDriver

getPageSource

public String getPageSource()
Specified by:
getPageSource in interface org.openqa.selenium.WebDriver

close

public void close()
Specified by:
close in interface org.openqa.selenium.WebDriver

getWindowHandles

public Set<String> getWindowHandles()
Specified by:
getWindowHandles in interface org.openqa.selenium.WebDriver

getWindowHandle

public String getWindowHandle()
Specified by:
getWindowHandle in interface org.openqa.selenium.WebDriver

switchTo

public org.openqa.selenium.WebDriver.TargetLocator switchTo()
Specified by:
switchTo in interface org.openqa.selenium.WebDriver

navigate

public org.openqa.selenium.WebDriver.Navigation navigate()
Specified by:
navigate in interface org.openqa.selenium.WebDriver

manage

public org.openqa.selenium.WebDriver.Options manage()
Specified by:
manage in interface org.openqa.selenium.WebDriver

executeScript

public Object executeScript(String script)

executeScript

public Object executeScript(String script,
                            Object... args)
Specified by:
executeScript in interface org.openqa.selenium.JavascriptExecutor

executeAsyncScript

public Object executeAsyncScript(String s,
                                 Object... objects)
Specified by:
executeAsyncScript in interface org.openqa.selenium.JavascriptExecutor

isJavascriptEnabled

public boolean isJavascriptEnabled()

getKeyboard

public org.openqa.selenium.interactions.Keyboard getKeyboard()
Specified by:
getKeyboard in interface org.openqa.selenium.interactions.HasInputDevices

getMouse

public org.openqa.selenium.interactions.Mouse getMouse()
Specified by:
getMouse in interface org.openqa.selenium.interactions.HasInputDevices


Copyright © 2014 Atlassian. All rights reserved.