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

      • executeScript

        public FluentJavascript executeScript​(java.lang.String script,
                                              java.lang.Object... args)
      • executeAsyncScript

        public FluentJavascript executeAsyncScript​(java.lang.String script,
                                                   java.lang.Object... args)
      • alert

        public org.openqa.selenium.Alert alert()
      • takeHtmlDump

        public void takeHtmlDump()
      • takeHtmlDump

        public void takeHtmlDump​(java.lang.String fileName)
      • canTakeScreenShot

        public boolean canTakeScreenShot()
      • takeScreenshot

        public void takeScreenshot()
      • takeScreenshot

        public void takeScreenshot​(java.lang.String fileName)
      • goTo

        public <P extends FluentPage> P goTo​(P page)
      • goTo

        public void goTo​(java.lang.String url)
      • goToInNewTab

        public void goToInNewTab​(java.lang.String url)
      • switchTo

        public void switchTo()
      • switchToDefault

        public void switchToDefault()
      • pageSource

        public java.lang.String pageSource()
      • getCookies

        public java.util.Set<org.openqa.selenium.Cookie> getCookies()
      • getCookie

        public org.openqa.selenium.Cookie getCookie​(java.lang.String name)
      • url

        public java.lang.String url()
      • getDriver

        public org.openqa.selenium.WebDriver getDriver()
      • injectComponent

        public ContainerContext injectComponent​(java.lang.Object componentContainer,
                                                java.lang.Object parentContainer,
                                                org.openqa.selenium.SearchContext context)
      • newInstance

        public <T> T newInstance​(java.lang.Class<T> cls)
      • newFluent

        public FluentWebElement newFluent​(org.openqa.selenium.WebElement element)
      • newComponent

        public <T> T newComponent​(java.lang.Class<T> componentClass,
                                  org.openqa.selenium.WebElement element)
      • asFluentList

        public FluentList<FluentWebElement> asFluentList​(java.lang.Iterable<org.openqa.selenium.WebElement> elements)
      • newFluentList

        public <T extends FluentWebElementFluentList<T> newFluentList​(java.lang.Class<T> componentClass,
                                                                        T... elements)
      • newFluentList

        public <T extends FluentWebElementFluentList<T> newFluentList​(java.lang.Class<T> componentClass,
                                                                        java.util.List<T> elements)
      • asFluentList

        public <T extends FluentWebElementFluentList<T> asFluentList​(java.lang.Class<T> componentClass,
                                                                       org.openqa.selenium.WebElement... elements)
      • asFluentList

        public <T extends FluentWebElementFluentList<T> asFluentList​(java.lang.Class<T> componentClass,
                                                                       java.lang.Iterable<org.openqa.selenium.WebElement> elements)
      • asFluentList

        public <T extends FluentWebElementFluentList<T> asFluentList​(java.lang.Class<T> componentClass,
                                                                       java.util.List<org.openqa.selenium.WebElement> elements)
      • newComponentList

        public <T> ComponentList<T> newComponentList​(java.lang.Class<T> componentClass)
      • asComponentList

        public <T> ComponentList<T> asComponentList​(java.lang.Class<T> componentClass,
                                                    org.openqa.selenium.WebElement... elements)
      • asComponentList

        public <T> ComponentList asComponentList​(java.lang.Class<T> componentClass,
                                                 java.lang.Iterable<org.openqa.selenium.WebElement> elements)
      • asComponentList

        public <T> ComponentList<T> asComponentList​(java.lang.Class<T> componentClass,
                                                    java.util.List<org.openqa.selenium.WebElement> elements)
      • newComponentList

        public <T> ComponentList<T> newComponentList​(java.lang.Class<T> componentClass,
                                                     T... componentsList)
      • newComponentList

        public <T> ComponentList<T> newComponentList​(java.lang.Class<T> componentClass,
                                                     java.util.List<T> componentsList)
      • newComponentList

        public <L extends java.util.List<T>,​T> L newComponentList​(java.lang.Class<L> listClass,
                                                                        java.lang.Class<T> componentClass)
      • asComponentList

        public <L extends java.util.List<T>,​T> L asComponentList​(java.lang.Class<L> listClass,
                                                                       java.lang.Class<T> componentClass,
                                                                       org.openqa.selenium.WebElement... elements)
      • asComponentList

        public <L extends java.util.List<T>,​T> L asComponentList​(java.lang.Class<L> listClass,
                                                                       java.lang.Class<T> componentClass,
                                                                       java.lang.Iterable<org.openqa.selenium.WebElement> elements)
      • asComponentList

        public <L extends java.util.List<T>,​T> L asComponentList​(java.lang.Class<L> listClass,
                                                                       java.lang.Class<T> componentClass,
                                                                       java.util.List<org.openqa.selenium.WebElement> elements)
      • newComponentList

        public <L extends java.util.List<T>,​T> L newComponentList​(java.lang.Class<L> listClass,
                                                                        java.lang.Class<T> componentClass,
                                                                        T... componentsList)
      • newComponentList

        public <L extends java.util.List<T>,​T> L newComponentList​(java.lang.Class<L> listClass,
                                                                        java.lang.Class<T> componentClass,
                                                                        java.util.List<T> componentsList)
      • isComponentClass

        public boolean isComponentClass​(java.lang.Class<?> componentClass)
      • capabilities

        public org.openqa.selenium.Capabilities capabilities()
      • isComponentListClass

        public boolean isComponentListClass​(java.lang.Class<? extends java.util.List<?>> componentListClass)
      • getWebDriver

        public java.lang.String getWebDriver()
      • getRemoteUrl

        public java.lang.String getRemoteUrl()
      • getCapabilities

        public org.openqa.selenium.Capabilities getCapabilities()
      • getBaseUrl

        public java.lang.String getBaseUrl()
      • getBrowserTimeout

        public java.lang.Long getBrowserTimeout()
      • getBrowserTimeoutRetries

        public java.lang.Integer getBrowserTimeoutRetries()
      • getDeleteCookies

        public java.lang.Boolean getDeleteCookies()
      • getPageLoadTimeout

        public java.lang.Long getPageLoadTimeout()
      • getImplicitlyWait

        public java.lang.Long getImplicitlyWait()
      • getScriptTimeout

        public java.lang.Long getScriptTimeout()
      • getAwaitAtMost

        public java.lang.Long getAwaitAtMost()
      • getAwaitPollingEvery

        public java.lang.Long getAwaitPollingEvery()
      • getEventsEnabled

        public java.lang.Boolean getEventsEnabled()
      • getScreenshotPath

        public java.lang.String getScreenshotPath()
      • getHtmlDumpPath

        public java.lang.String getHtmlDumpPath()
      • getConfigurationFactory

        public java.lang.Class<? extends ConfigurationFactory> getConfigurationFactory()
      • getCustomProperty

        public java.lang.String getCustomProperty​(java.lang.String propertyName)
      • setWebDriver

        public void setWebDriver​(java.lang.String webDriver)
      • setBrowserTimeout

        public void setBrowserTimeout​(java.lang.Long timeout)
      • setBrowserTimeoutRetries

        public void setBrowserTimeoutRetries​(java.lang.Integer retriesNumber)
      • setRemoteUrl

        public void setRemoteUrl​(java.lang.String remoteUrl)
      • setCapabilities

        public void setCapabilities​(org.openqa.selenium.Capabilities capabilities)
      • setConfigurationFactory

        public void setConfigurationFactory​(java.lang.Class<? extends ConfigurationFactory> configurationFactory)
      • setDeleteCookies

        public void setDeleteCookies​(java.lang.Boolean deleteCookies)
      • setBaseUrl

        public void setBaseUrl​(java.lang.String baseUrl)
      • setPageLoadTimeout

        public void setPageLoadTimeout​(java.lang.Long pageLoadTimeout)
      • setImplicitlyWait

        public void setImplicitlyWait​(java.lang.Long implicitlyWait)
      • setAwaitAtMost

        public void setAwaitAtMost​(java.lang.Long awaitAtMost)
      • setAwaitPollingEvery

        public void setAwaitPollingEvery​(java.lang.Long awaitPollingEvery)
      • setScriptTimeout

        public void setScriptTimeout​(java.lang.Long scriptTimeout)
      • setEventsEnabled

        public void setEventsEnabled​(java.lang.Boolean eventsEnabled)
      • setScreenshotPath

        public void setScreenshotPath​(java.lang.String screenshotPath)
      • setHtmlDumpPath

        public void setHtmlDumpPath​(java.lang.String htmlDumpPath)
      • setCustomProperty

        public void setCustomProperty​(java.lang.String key,
                                      java.lang.String value)
      • 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