Class FluentWebElement

    • Constructor Detail

      • FluentWebElement

        public FluentWebElement​(org.openqa.selenium.WebElement element,
                                FluentControl control,
                                ComponentInstantiator instantiator)
        Creates a new fluent web element.
        Parameters:
        element - underlying element
        control - control interface
        instantiator - component instantiator
    • Method Detail

      • now

        public FluentWebElement now​(boolean force)
        Description copied from interface: FluentProxyState
        Search for the element now, actually performing the search on the WebDriver.

        It has no effect if the element is already loaded.

        Specified by:
        now in interface FluentProxyState<FluentWebElement>
        Parameters:
        force - force the search even if element is already loaded
        Returns:
        this object reference to chain calls.
      • axes

        @Deprecated
        public Dom axes()
        Deprecated.
        Use dom() instead.
        XPath Axes accessor (parent, ancestors, preceding, following, ...).
        Returns:
        object to perform XPath Axes transformations.
      • dom

        public Dom dom()
        XPath Axes accessor (parent, ancestors, preceding, following, ...).
        Returns:
        object to perform XPath Axes transformations.
      • conditions

        public FluentConditions conditions()
        Get a conditions object used to verify condition on this element.
        Returns:
        conditions object
      • await

        public FluentWaitElement await()
        Build a wait object to wait for a condition of this element.
        Returns:
        a wait object
      • mouse

        public MouseElementActions mouse()
        Execute mouse actions on the element
        Returns:
        mouse actions object
      • keyboard

        public KeyboardElementActions keyboard()
        Execute keyboard actions on the element
        Returns:
        keyboard actions object
      • as

        public <T> T as​(java.lang.Class<T> componentClass)
        Wrap all underlying elements in a component.
        Type Parameters:
        T - type of component
        Parameters:
        componentClass - component class
        Returns:
        element as component.
      • clear

        public FluentWebElement clear()
        Clear the element
        Returns:
        fluent web element
      • clearReactInput

        public FluentWebElement clearReactInput()
        Clear React input using Backspace only
        Returns:
        fluent web element
      • name

        public java.lang.String name()
        return the name of the element
        Returns:
        name of the element
      • attribute

        public java.lang.String attribute​(java.lang.String name)
        return any value of custom attribute (generated=true will return "true" if attribute("generated") is called.
        Parameters:
        name - custom attribute name
        Returns:
        name value
        See Also:
        WebElement.getAttribute(String)
      • cssValue

        public java.lang.String cssValue​(java.lang.String propertyName)
        Get the value of a given CSS property.
        Parameters:
        propertyName - the css property name of the element
        Returns:
        The current, computed value of the property.
        See Also:
        WebElement.getCssValue(String)
      • id

        public java.lang.String id()
        return the id of the elements
        Returns:
        id of element
      • text

        public java.lang.String text()
        return the visible text of the element
        Returns:
        text of element
        See Also:
        WebElement.getText()
      • textContent

        public java.lang.String textContent()
        return the text content of the element (even invisible through textContent attribute)
        Returns:
        text content of element
      • value

        public java.lang.String value()
        return the value of the elements
        Returns:
        value of attribute
      • displayed

        public boolean displayed()
        return true if the element is displayed, other way return false
        Returns:
        boolean value of displayed check
        See Also:
        WebElement.isDisplayed()
      • enabled

        public boolean enabled()
        return true if the element is enabled, other way return false
        Returns:
        boolean value of enabled check
        See Also:
        WebElement.isEnabled()
      • selected

        public boolean selected()
        return true if the element is selected, other way false
        Returns:
        boolean value of selected check
        See Also:
        WebElement.isSelected()
      • clickable

        public boolean clickable()
        Check that this element is visible and enabled such that you can click it.
        Returns:
        true if the element can be clicked, false otherwise.
      • stale

        public boolean stale()
        Check that this element is no longer attached to the DOM.
        Returns:
        false is the element is still attached to the DOM, true otherwise.
      • tagName

        public java.lang.String tagName()
        return the tag name
        Returns:
        string value of tag name
        See Also:
        WebElement.getTagName()
      • getElement

        public org.openqa.selenium.WebElement getElement()
        return the webElement
        Returns:
        web element
      • getWrappedElement

        public org.openqa.selenium.WebElement getWrappedElement()
        Specified by:
        getWrappedElement in interface org.openqa.selenium.WrapsElement
      • size

        public org.openqa.selenium.Dimension size()
        return the size of the element
        Returns:
        dimension/size of element
        See Also:
        WebElement.getSize()
      • $

        public FluentList<FluentWebElement> $​(java.util.List<org.openqa.selenium.WebElement> rawElements)
        Description copied from interface: SearchControl
        Wrap raw selenium elements into a list of elements.
        Specified by:
        $ in interface SearchControl<FluentWebElement>
        Parameters:
        rawElements - raw selenium elements
        Returns:
        list of element
      • el

        public FluentWebElement el​(org.openqa.selenium.WebElement rawElement)
        Description copied from interface: SearchControl
        Wrap existing raw selenium element into an element.
        Specified by:
        el in interface SearchControl<FluentWebElement>
        Parameters:
        rawElement - raw selenium element
        Returns:
        element
      • html

        public java.lang.String html()
        Get the HTML of a the element
        Returns:
        the underlying html content
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • noHook

        public <R> R noHook​(java.lang.Class<? extends FluentHook> hook,
                            java.util.function.Function<FluentWebElement,​R> function)
        Description copied from interface: HookControl
        Invoke a function with no hook.
        Specified by:
        noHook in interface HookControl<FluentWebElement>
        Type Parameters:
        R - return type
        Parameters:
        hook - hook class to disable
        function - function to invoke
        Returns:
        return value of the given function
      • withHook

        public <O,​H extends FluentHook<O>> FluentWebElement withHook​(java.lang.Class<H> hook,
                                                                           O options)
        Description copied from interface: HookControl
        Enable a hook with given options.
        Specified by:
        withHook in interface HookControl<FluentWebElement>
        Type Parameters:
        O - Type of the hook
        H - Type of the hook options
        Parameters:
        hook - hook class to enable
        options - hook options to apply
        Returns:
        this object reference to chain calls
      • withHook

        public <O,​H extends FluentHook<O>> FluentWebElement withHook​(java.lang.Class<H> hook)
        Description copied from interface: HookControl
        Enable a hook with default options.
        Specified by:
        withHook in interface HookControl<FluentWebElement>
        Type Parameters:
        O - Type of the hook
        H - Type of the hook options
        Parameters:
        hook - hook class to enable
        Returns:
        this object reference to chain calls
      • noHook

        public <R> R noHook​(java.util.function.Function<FluentWebElement,​R> function)
        Description copied from interface: HookControl
        Invoke a function with no hook.
        Specified by:
        noHook in interface HookControl<FluentWebElement>
        Type Parameters:
        R - return type
        Parameters:
        function - function to invoke
        Returns:
        return value of the given function
      • scrollIntoView

        public FluentWebElement scrollIntoView​(boolean alignWithTop)
        Description copied from interface: FluentJavascriptActions
        Scrolls the current element into the visible area of the browser window.
        Specified by:
        scrollIntoView in interface FluentJavascriptActions
        Parameters:
        alignWithTop - If true, the top of the element will be aligned to the top of the visible area of the scrollable ancestor. If false, the bottom of the element will be aligned to the bottom of the visible area of the scrollable ancestor.
        Returns:
        this object reference to chain methods calls
        See Also:
        element.scrollIntoView
      • withLabelHint

        public FluentWebElement withLabelHint​(java.lang.String... labelHint)
        Description copied from interface: FluentLabel
        Add a label hint that will be appended to the representation of this object for error message.
        Specified by:
        withLabelHint in interface FluentLabel<FluentWebElement>
        Parameters:
        labelHint - label hints to add
        Returns:
        reference to this object to chain calls
      • withLabel

        public FluentWebElement withLabel​(java.lang.String label)
        Description copied from interface: FluentLabel
        Apply a label that will be displayed as the representation of this object for error message.
        Specified by:
        withLabel in interface FluentLabel<FluentWebElement>
        Parameters:
        label - label to use
        Returns:
        reference to this object to chain calls