Class HtmlFileDownloader


  • public class HtmlFileDownloader
    extends Object
    • Constructor Detail

      • HtmlFileDownloader

        public HtmlFileDownloader​(org.openqa.selenium.WebDriver driverObject)
    • Method Detail

      • getDownloadDir

        public String getDownloadDir()
        Returns:
        The download directory where the files will be downloaded to.
      • setDownloadDir

        public void setDownloadDir​(String downloadDir)
        Parameters:
        downloadDir - The download directory where the files will be downloaded to.
      • downloadFileFromLink

        public String downloadFileFromLink​(String pageUrl,
                                           HtmlElement linkElement)
                                    throws Exception
        Download the file specified in the href attribute of a HtmlElement
        Parameters:
        linkElement -
        Returns:
        Throws:
        Exception
      • getHTTPStatusOfLastDownloadAttempt

        public int getHTTPStatusOfLastDownloadAttempt()
        Gets the HTTP status code of the last download file attempt
        Returns:
      • mimicWebDriverCookieState

        public void mimicWebDriverCookieState​(boolean value)
        Mimic the cookie state of WebDriver (Defaults to true) This will enable you to access files that are only available when logged in. If set to false the connection will be made as an anonymous user
        Parameters:
        value -
      • downloadFile

        public String downloadFile​(String downloadUrl)
                            throws IOException
        Perform the file/image download.
        Parameters:
        downloadUrl -
        Returns:
        download file absolute path
        Throws:
        IOException
        FileTransferClientException