Class PageAreaImpl

    • Constructor Detail

      • PageAreaImpl

        protected PageAreaImpl​(PageObject context,
                               String path)
        Parameters:
        context - Parent page object area is scoped to.
        path - Absolute path to the area.
      • PageAreaImpl

        protected PageAreaImpl​(PageArea area,
                               String path)
        Parameters:
        area - Parent area new area is scoped to.
        path - Absolute or relative path prefix, if absolute must be prefixed by area.getPath(). IOW, it needs to be in parent area.
    • Method Detail

      • self

        public org.openqa.selenium.WebElement self()
        Description copied from interface: PageArea
        Returns WebElement that corresponds to the element that sits at the root of the area this object represents.
        Specified by:
        self in interface PageArea
      • control

        public Control control​(String... relativePaths)
        Create a control object that wraps access to the specific INPUT element in this page area.

        The Control object itself can be created early as the actual element resolution happens lazily. This means PageArea implementations can put these in their fields.

        Several paths can be provided to find the first matching element. Useful when element path changed between versions.

        Specified by:
        control in interface PageArea
      • control

        public Control control​(org.openqa.selenium.By selector)
        Specified by:
        control in interface PageArea
      • createPageArea

        @NonNull
        public String createPageArea​(String name,
                                     Runnable action)
                              throws org.openqa.selenium.TimeoutException
        Description copied from interface: PageArea
        Capture path attribute of newly created form chunk upon invoking action.

        Consider "Add" button in page area with path "/foo" that is supposed to create new page area with path "/foo/bar" or "/foo/bar[n]". There are several problems with the straightforward approach: - Created area may or may not be the first one of its kind so figuring the "path" is nontrivial. - The area may can take a while to render so waiting is needed. - Even after the markup appears, it can take a while for "path" attribute is added.

        This method properly wait until the new path is known. To be used as:

         
          String barPath = fooArea.createPageArea("bar", () -> control("add-button").click());
          new FooBarArea(fooArea, barPath);
          
          
        Specified by:
        createPageArea in interface PageArea
        Parameters:
        name - Name of the surrounding div which will the next segment in path. Given the area is "/builder" and we are about to construct /builder/shell[3], the relative prefix is "shell".
        action - An action that triggers the page area creation. Clicking the button, etc.
        Returns:
        The surrounding path of the area, exception thrown when not able to find out.
        Throws:
        org.openqa.selenium.TimeoutException