org.unitils.selenium
Class ScreenshotTakingWebDriver

java.lang.Object
  extended by com.thoughtworks.selenium.DefaultSelenium
      extended by com.thoughtworks.selenium.webdriven.WebDriverBackedSelenium
          extended by org.unitils.selenium.ScreenshotTakingWebDriver
All Implemented Interfaces:
com.thoughtworks.selenium.Selenium, org.openqa.selenium.HasCapabilities, org.openqa.selenium.internal.WrapsDriver

public class ScreenshotTakingWebDriver
extends com.thoughtworks.selenium.webdriven.WebDriverBackedSelenium

Decorator for the WebDriverBackedSelenium class to handle screenshots.

Since:
1.0.4
Author:
Jef Verelst

Field Summary
 
Fields inherited from class com.thoughtworks.selenium.DefaultSelenium
commandProcessor
 
Constructor Summary
ScreenshotTakingWebDriver(com.google.common.base.Supplier<org.openqa.selenium.WebDriver> maker, String baseUrl)
          Constructor.
ScreenshotTakingWebDriver(org.openqa.selenium.WebDriver baseDriver, String baseUrl)
          Constructor.
 
Method Summary
 void clickWithScreenshot(String locator)
          Create a screenshot when a specified WebElement is clicked.
 void clickWithScreenshotAt(String locator, String coordString)
          Create a screenshot when a specified WebElement is clicked.
 void saveScreenshot()
          Save a screenshot with a default name in the default folder.
 void saveScreenshot(File screenshotDir, String fileName)
          Store a screenshot with a specified name in a specified folder.
 void saveScreenshot(String fileName)
          Save a screenshot with a specified name in the default folder.
 void waitForFrameToLoad(String frameAddress, String timeout)
           
 void waitForPageToLoad(String timeout)
           
 
Methods inherited from class com.thoughtworks.selenium.webdriven.WebDriverBackedSelenium
getCapabilities, getWrappedDriver
 
Methods inherited from class com.thoughtworks.selenium.DefaultSelenium
addCustomRequestHeader, addLocationStrategy, addScript, addSelection, allowNativeXpath, altKeyDown, altKeyUp, answerOnNextPrompt, assignId, attachFile, captureEntirePageScreenshot, captureEntirePageScreenshotToString, captureNetworkTraffic, captureScreenshot, captureScreenshotToString, check, chooseCancelOnNextConfirmation, chooseOkOnNextConfirmation, click, clickAt, close, contextMenu, contextMenuAt, controlKeyDown, controlKeyUp, createCookie, deleteAllVisibleCookies, deleteCookie, deselectPopUp, doubleClick, doubleClickAt, dragAndDrop, dragAndDropToObject, dragdrop, fireEvent, focus, getAlert, getAllButtons, getAllFields, getAllLinks, getAllWindowIds, getAllWindowNames, getAllWindowTitles, getAttribute, getAttributeFromAllWindows, getBodyText, getConfirmation, getCookie, getCookieByName, getCssCount, getCursorPosition, getElementHeight, getElementIndex, getElementPositionLeft, getElementPositionTop, getElementWidth, getEval, getExpression, getHtmlSource, getLocation, getLog, getMouseSpeed, getPrompt, getSelectedId, getSelectedIds, getSelectedIndex, getSelectedIndexes, getSelectedLabel, getSelectedLabels, getSelectedValue, getSelectedValues, getSelectOptions, getSpeed, getTable, getText, getTitle, getValue, getWhetherThisFrameMatchFrameExpression, getWhetherThisWindowMatchWindowExpression, getXpathCount, goBack, highlight, ignoreAttributesWithoutValue, isAlertPresent, isChecked, isConfirmationPresent, isCookiePresent, isEditable, isElementPresent, isOrdered, isPromptPresent, isSomethingSelected, isTextPresent, isVisible, keyDown, keyDownNative, keyPress, keyPressNative, keyUp, keyUpNative, metaKeyDown, metaKeyUp, mouseDown, mouseDownAt, mouseDownRight, mouseDownRightAt, mouseMove, mouseMoveAt, mouseOut, mouseOver, mouseUp, mouseUpAt, mouseUpRight, mouseUpRightAt, open, open, openWindow, refresh, removeAllSelections, removeScript, removeSelection, retrieveLastRemoteControlLogs, rollup, runScript, select, selectFrame, selectPopUp, selectWindow, setBrowserLogLevel, setContext, setCursorPosition, setExtensionJs, setMouseSpeed, setSpeed, setTimeout, shiftKeyDown, shiftKeyUp, showContextualBanner, showContextualBanner, shutDownSeleniumServer, start, start, start, stop, submit, type, typeKeys, uncheck, useXpathLibrary, waitForCondition, waitForPopUp, windowFocus, windowMaximize
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ScreenshotTakingWebDriver

public ScreenshotTakingWebDriver(com.google.common.base.Supplier<org.openqa.selenium.WebDriver> maker,
                                 String baseUrl)
Constructor.

Parameters:
maker - : should be of type Supplier.
baseUrl - : this is the url where the webdriver should start with.

ScreenshotTakingWebDriver

public ScreenshotTakingWebDriver(org.openqa.selenium.WebDriver baseDriver,
                                 String baseUrl)
Constructor.

Parameters:
baseDriver - : should be of type WebDriver.
baseUrl - : this is the url where the webdriver should start with.
Method Detail

saveScreenshot

public void saveScreenshot()
Save a screenshot with a default name in the default folder.


saveScreenshot

public void saveScreenshot(String fileName)
Save a screenshot with a specified name in the default folder.

Parameters:
fileName - of the screenshot

saveScreenshot

public void saveScreenshot(File screenshotDir,
                           String fileName)
Store a screenshot with a specified name in a specified folder.

Parameters:
screenshotDir - : the directory where the screenshots should be saved.
fileName - : the name of the new screenshot.

clickWithScreenshot

public void clickWithScreenshot(String locator)
Create a screenshot when a specified WebElement is clicked.

Parameters:
locator - (f.e. a button).

clickWithScreenshotAt

public void clickWithScreenshotAt(String locator,
                                  String coordString)
Create a screenshot when a specified WebElement is clicked.

Parameters:
locator - (f.e. a button).
coordString - : the coördinations of that webelement.

waitForPageToLoad

public void waitForPageToLoad(String timeout)
Specified by:
waitForPageToLoad in interface com.thoughtworks.selenium.Selenium
Overrides:
waitForPageToLoad in class com.thoughtworks.selenium.DefaultSelenium

waitForFrameToLoad

public void waitForFrameToLoad(String frameAddress,
                               String timeout)
Specified by:
waitForFrameToLoad in interface com.thoughtworks.selenium.Selenium
Overrides:
waitForFrameToLoad in class com.thoughtworks.selenium.DefaultSelenium


Copyright © 2015. All Rights Reserved.