com.atlassian.webdriver.debug
Class WebDriverDebug

java.lang.Object
  extended by com.atlassian.webdriver.debug.WebDriverDebug

public final class WebDriverDebug
extends Object

An injectable component for performing common debug operations using WebDriver.

Since:
2.2

Constructor Summary
WebDriverDebug(org.openqa.selenium.WebDriver webDriver)
           
 
Method Summary
 boolean dumpPageSourceTo(Writer writer)
          

Writes the source of the last loaded page to the specified writer.

 boolean dumpSourceTo(File dumpFile)
          

Writes the source of the last loaded page to the specified file.

 String getCurrentUrl()
          Get the URL that the underlying web driver is currently at.
 boolean takeScreenshotTo(File destFile)
          Saves screen shot of the browser to the specified file.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WebDriverDebug

@Inject
public WebDriverDebug(@Nonnull
                             org.openqa.selenium.WebDriver webDriver)
Method Detail

getCurrentUrl

@Nonnull
public String getCurrentUrl()
Get the URL that the underlying web driver is currently at.

Returns:
current URL

dumpSourceTo

public boolean dumpSourceTo(@Nonnull
                            File dumpFile)

Writes the source of the last loaded page to the specified file. See dumpPageSourceTo(java.io.Writer) for details on how it works.

As opposed to dumpPageSourceTo(java.io.Writer), this method makes sure to close the handle used to write to dumpFile.

Parameters:
dumpFile - File to write the source to.

dumpPageSourceTo

public boolean dumpPageSourceTo(@Nonnull
                                Writer writer)

Writes the source of the last loaded page to the specified writer. The writer is othewrwise not interacted with. In particular, clients have to take care to close the writer.

This method will attempt to not propagate any exceptions that prevent it from completing. Instead, the write will be aborted, the exception logged and false returned. The only exception raised by this method is NullPointerException in case writer is null.

Parameters:
writer - writer to write the page source to

takeScreenshotTo

public boolean takeScreenshotTo(@Nonnull
                                File destFile)
Saves screen shot of the browser to the specified file.

Parameters:
destFile - File to save screen shot.


Copyright © 2014 Atlassian. All rights reserved.