WebLibrary

Ranorex Studio provides a wide range of web testing capabilities that require no coding skills. However, some functionality is impossible or a lot of work to implement without coding. The WebLibrary contains several useful methods that solve this issue.

To use them, simply ⇢ add the individual methods to the desired recording modules and configure them as described on this page.

On this page

    DownloadFile

    It may often be necessary to download a file during a web test. This is possible without any coding, but the DownloadFile method simplifies the process.

    The available arguments for the method are:

    String uri

    • URI of the file to download.
    • If the address is wrong or the file can’t be found, returns an error.
    • In this case, the test module containing the method will fail and the report will log a failure.

    String localPath

    • The path to the folder where you want to save the file. Can be absolute or relative.
    • If left empty, saves the file in the output folder of the test solution.

    Boolean overwriteExisting

    • true = if the file already exists in the target location, overwrites it.
    • false = does not overwrite the file, but returns a warning and aborts the download.

    The results are also logged to the report:

    Report showing successful download of the file

    Report showing aborted download, as the file already existed and overwriteExisting was set to false

    Report showing a failed module because the file could not be downloaded

    GetHttpStatusCode

    Checks a website at the specified URL and returns its HTTP status code. The following arguments are available:

    String returnValue

    • The HTTP status code returned by the method.
    • Can be passed on to a variable.

    String url

    • The URL of the website whose status you want to check.

    The results are also logged to the report:

    ReportFullPageScreenshot

    Creates a full screenshot of a webpage, including elements that are currently not displayed on screen. The webpage must be saved as a repository item and passed to the method as an argument.

    The screenshot is saved in the output folder and also logged to the report.

    RepoItemInfo repoItemInfo

    • The repository item that represents the webpage you want to screenshot.
    • If it isn’t a webpage, an error will be logged to the report. The containing module will not fail, however.