Class Urls

java.lang.Object
org.openqa.selenium.net.Urls

public class Urls extends Object
  • Method Details

    • urlEncode

      public static String urlEncode(String value)
      Encodes the text as an URL using UTF-8.
      Parameters:
      value - the text too encode
      Returns:
      the encoded URI string
      See Also:
    • fromUri

      public static URL fromUri(URI uri)
    • from

      public static URI from(String rawUri)
      Convert a string, which may just be a hostname, into a valid URI. If no scheme is given, it is set to http by default.

      We prefer to use URI instead of URL since the latter requires a scheme handler to be registered for types, so strings like docker://localhost:1234 would not generally be a valid URL but would be a correct URI.

      A known limitation is that URI fragments are not handled. In the expected use cases for this method, that is not a problem.