Class FluentPage

    • Constructor Detail

      • FluentPage

        public FluentPage()
        Creates a new fluent page.
      • FluentPage

        public FluentPage​(FluentControl control)
        Creates a new fluent page, using given fluent control.
        Parameters:
        control - fluent control
    • Method Detail

      • getUrl

        public String getUrl()
        Description copied from interface: FluentPageControl
        URL of the page It can contains mandatory parameters {param} and optional parameters {param1}
        Specified by:
        getUrl in interface FluentPageControl
        Returns:
        page URL
      • getParam

        public String getParam​(String parameterName)
        Parses the current URL and returns the parameter value for the argument parameter name.

        In case the parameter is not defined in the PageUrl annotation, or the parameter (mandatory or optional) has no value in the actual URL, this method returns null.

        There is also caching in place to improve performance. It compares the current URL with the cached URL, and if they are the same, the parameter is returned from the cached values, otherwise the URL is parsed again and the parameters are returned from the new URL.

        Examples (for template + URL + paramName combinations):

         "/abc/{param1}/def/{param2}"  + "/abc/param1val/def/param2val" + "param1" -> "param1val"
         "/abc/{param1}/def/{param2}"  + "/abc/param1val/def/param2val" + "param4" -> null
         "/abc{?/param1}/def/{param2}" + "/abc/param1val/def/param2val" + "param1" -> "param1val"
         "/abc{?/param1}/def/{param2}" + "/abc/def/param2val"           + "param1" -> ull
         
        Parameters:
        parameterName - the parameter to get the value of
        Returns:
        the desired parameter value or null if a value for the given parameter name is not present
        Throws:
        IllegalArgumentException - when the argument param is null or empty
      • getUrl

        public String getUrl​(Object... parameters)
        Description copied from interface: FluentPageControl
        URL of the page, after replacing parameters with given values.
        Specified by:
        getUrl in interface FluentPageControl
        Parameters:
        parameters - parameter values
        Returns:
        Effective url generated for given parameter values
      • isAt

        public void isAt​(Object... parameters)
        Description copied from interface: FluentPageControl
        Check if the browser is on this page, after replacing parameters with given values.
        Specified by:
        isAt in interface FluentPageControl
        Parameters:
        parameters - list of parameters
      • isAtUsingUrl

        public void isAtUsingUrl​(String urlTemplate)
        URL matching implementation for isAt().

        If there is a PageUrl annotation applied on the class and it has the file attribute defined this method will skip the url parsing to skip URL check because it is not able to get local file path relatively.

        Parameters:
        urlTemplate - URL Template
        Throws:
        AssertionError - when the current URL doesn't match the expected page URL
      • isAtUsingSelector

        public void isAtUsingSelector​(org.openqa.selenium.By by)
        Selector matching implementation for isAt().
        Parameters:
        by - by selector
        Throws:
        AssertionError - if the element using the argument By is not found for the current page
      • go

        public <P extends FluentPage> P go​(Object... params)
        Description copied from interface: FluentPageControl
        Got to the url defined in the page, using given parameters.
        Specified by:
        go in interface FluentPageControl
        Parameters:
        params - page url parameter values
        Returns:

        FluentPage object