Package com.xceptance.xlt.api.util

# Class BasicPageUtils

java.lang.Object
com.xceptance.xlt.api.util.BasicPageUtils

Direct Known Subclasses:
  `HtmlPageUtils`, `LightweightHtmlPageUtils`

public class BasicPageUtils extends Object
The `BasicPageUtils` class provides common helper methods for its child classes. It is not meant to be used directly.

See Also:
  - `HtmlPageUtils`
  - `LightweightHtmlPageUtils`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `BasicPageUtils()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `static String`
  `getAbsoluteUrl(String baseUrl, String relativePath)`
  Returns an absolute URL built from the passed base URL and relative path.
  `static String`
  `getAbsoluteUrl(URL baseUrl, String relativePath)`
  Returns an absolute URL built from the passed base URL and relative path.
  `static <T> T`
  `pickOneRandomly(List<T> elements)`
  Returns one entry from the passed list, chosen randomly.
  `static <T> T`
  `pickOneRandomly(List<T> elements, boolean excludeFirst)`
  Returns one entry from the passed list, chosen randomly.
  `static <T> T`
  `pickOneRandomly(List<T> elements, boolean excludeFirst, boolean excludeLast)`
  Returns one entry from the passed list, chosen randomly.

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### BasicPageUtils

    public BasicPageUtils()

- ## Method Details

  - ### getAbsoluteUrl

    public static String getAbsoluteUrl(String baseUrl, String relativePath) throws MalformedURLException
    Returns an absolute URL built from the passed base URL and relative path.
    Parameters:
      `baseUrl` - the base URL as a string
      `relativePath` - the relative path
    Returns:
      the new absolute URL
    Throws:
      `MalformedURLException` - if the new URL is invalid

  - ### getAbsoluteUrl

    public static String getAbsoluteUrl(URL baseUrl, String relativePath) throws MalformedURLException
    Returns an absolute URL built from the passed base URL and relative path.
    Parameters:
      `baseUrl` - the base URL
      `relativePath` - the relative path
    Returns:
      the new absolute URL
    Throws:
      `MalformedURLException` - if the new URL is invalid

  - ### pickOneRandomly

    public static <T> T pickOneRandomly(List<T> elements)
    Returns one entry from the passed list, chosen randomly.
    Type Parameters:
      `T` - the type of the elements in the list
    Parameters:
      `elements` - the list
    Returns:
      one element from the list

  - ### pickOneRandomly

    public static <T> T pickOneRandomly(List<T> elements, boolean excludeFirst)
    Returns one entry from the passed list, chosen randomly. It can be specified whether or not the first entry is to be ignored.
    Type Parameters:
      `T` - the type of the elements in the list
    Parameters:
      `elements` - the list
      `excludeFirst` - whether or not the first entry is to be excluded
    Returns:
      one element from the list

  - ### pickOneRandomly

    public static <T> T pickOneRandomly(List<T> elements, boolean excludeFirst, boolean excludeLast)
    Returns one entry from the passed list, chosen randomly. It can be specified whether or not the first and/or the last entries are to be ignored.
    Type Parameters:
      `T` - the type of the elements in the list
    Parameters:
      `elements` - the list
      `excludeFirst` - whether or not the first entry is to be excluded
      `excludeLast` - whether or not the last entry is to be excluded
    Returns:
      one element from the list