ch.racic.selenium.helper.download
Class SeleniumDownloadHelper

java.lang.Object
  extended by ch.racic.selenium.helper.download.SeleniumDownloadHelper

public class SeleniumDownloadHelper
extends Object

Created by rac on 08.06.14.


Constructor Summary
SeleniumDownloadHelper(org.openqa.selenium.WebDriver driver)
          Initialize the SeleniumDownloadHelper with the given driver as context.
 
Method Summary
 File getFileFromUrl(URL url)
          Executes XHR request trough JavaScript to download the given file in the context of the current WebDriver session.
 File getFileFromUrl(URL url, File outputFile)
          Executes XHR request trough JavaScript to download the given file in the context of the current WebDriver session.
 FileData getFileFromUrlRaw(URL url)
          Executes XHR request trough JavaScript to download the given file in the context of the current WebDriver session.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SeleniumDownloadHelper

public SeleniumDownloadHelper(org.openqa.selenium.WebDriver driver)
                       throws IOException
Initialize the SeleniumDownloadHelper with the given driver as context. Javascript will be injected at the current page of this driver at the moment of calling the download method.

Parameters:
driver -
Throws:
IOException
Method Detail

getFileFromUrlRaw

public FileData getFileFromUrlRaw(URL url)
Executes XHR request trough JavaScript to download the given file in the context of the current WebDriver session.

Parameters:
url -
Returns:
raw data

getFileFromUrl

public File getFileFromUrl(URL url,
                           File outputFile)
                    throws IOException
Executes XHR request trough JavaScript to download the given file in the context of the current WebDriver session.

Parameters:
url -
outputFile -
Returns:
outpuFile
Throws:
IOException

getFileFromUrl

public File getFileFromUrl(URL url)
                    throws IOException
Executes XHR request trough JavaScript to download the given file in the context of the current WebDriver session. This method returns a tmp file and takes a guessed filename

Parameters:
url -
Returns:
outpuFile
Throws:
IOException


Copyright © 2014. All rights reserved.