Interface SelenideElement

  • All Superinterfaces:
    org.openqa.selenium.interactions.internal.Locatable, org.openqa.selenium.interactions.Locatable, org.openqa.selenium.SearchContext, org.openqa.selenium.TakesScreenshot, org.openqa.selenium.WebElement, org.openqa.selenium.WrapsDriver, org.openqa.selenium.internal.WrapsElement, org.openqa.selenium.WrapsElement

    public interface SelenideElement
    extends org.openqa.selenium.WebElement, org.openqa.selenium.WrapsDriver, org.openqa.selenium.internal.WrapsElement, org.openqa.selenium.interactions.internal.Locatable, org.openqa.selenium.TakesScreenshot
    Wrapper around WebElement with additional methods like shouldBe(Condition...) and shouldHave(Condition...)
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      SelenideElement $​(java.lang.String cssSelector)
      ATTENTION! This method doesn't start any search yet! Same as find(String)
      SelenideElement $​(java.lang.String cssSelector, int index)
      ATTENTION! This method doesn't start any search yet! Same as find(String, int)
      SelenideElement $​(org.openqa.selenium.By selector)
      ATTENTION! This method doesn't start any search yet! Same as find(String)
      SelenideElement $​(org.openqa.selenium.By selector, int index)
      ATTENTION! This method doesn't start any search yet! Same as find(String, int)
      ElementsCollection $$​(java.lang.String cssSelector)
      ATTENTION! This method doesn't start any search yet! Same as findAll(String)
      ElementsCollection $$​(org.openqa.selenium.By selector)
      Same as findAll(By)
      ElementsCollection $$x​(java.lang.String xpath)
      Short form of webDriver.findElements(thisElement, By.xpath(xpath))
      SelenideElement $x​(java.lang.String xpath)
      Locates the first matching element inside given element using xpath locator
      SelenideElement $x​(java.lang.String xpath, int index)
      Locates the Nth matching element inside given element using xpath locator
      SelenideElement append​(java.lang.String text)
      Append given test to the text field and trigger "change" event.
      java.lang.String attr​(java.lang.String attributeName)
      Get the attribute of the element.
      void click()
      Click the element
      void click​(int offsetX, int offsetY)
      Click the element with a relative offset from the center of the element
      SelenideElement closest​(java.lang.String tagOrClass)
      Locates closes ancestor element matching given criteria ATTENTION! This method doesn't start any search yet! For example, $("td").closest("table") could give some "table".
      SelenideElement contextClick()
      Click with right mouse button on this element
      java.lang.String data​(java.lang.String dataAttributeName)
      Get value of attribute "data-dataAttributeName"
      SelenideElement doubleClick()
      Double click the element
      java.io.File download()
      Download file linked by "href" attribute of this element
      java.io.File download​(long timeout)
      Download file linked by "href" attribute of this element or any file to which this element redirects.
      SelenideElement dragAndDropTo​(java.lang.String targetCssSelector)
      Drag and drop this element to the target Before dropping, waits until target element gets visible.
      SelenideElement dragAndDropTo​(org.openqa.selenium.WebElement target)
      Drag and drop this element to the target Before dropping, waits until target element gets visible.
      <ReturnType>
      ReturnType
      execute​(Command<ReturnType> command)
      Execute custom implemented command
      boolean exists()
      Checks if element exists true on the current page.
      SelenideElement find​(java.lang.String cssSelector)
      Locates the first matching element inside given element
      SelenideElement find​(java.lang.String cssSelector, int index)
      Locates the Nth matching element inside given element
      SelenideElement find​(org.openqa.selenium.By selector)
      ATTENTION! This method doesn't start any search yet! Same as find(String)
      SelenideElement find​(org.openqa.selenium.By selector, int index)
      ATTENTION! This method doesn't start any search yet! Same as find(String, int)
      ElementsCollection findAll​(java.lang.String cssSelector)
      Short form of webDriver.findElements(thisElement, By.cssSelector(cssSelector))
      ElementsCollection findAll​(org.openqa.selenium.By selector)
      Short form of webDriver.findElements(thisElement, selector)
      java.lang.String getSearchCriteria()
      Return criteria by which this element is located
      SelenideElement getSelectedOption()
      Find (first) selected option from this select field
      ElementsCollection getSelectedOptions()
      Find all selected options from this select field
      java.lang.String getSelectedText()
      Get text of selected option in select field
      java.lang.String getSelectedValue()
      Get value of selected option in select field
      java.lang.String getText()
      Get the visible text of this element, including sub-elements without leading/trailing whitespace.
      java.lang.String getValue()
      Get the "value" attribute of the element
      org.openqa.selenium.WebElement getWrappedElement()  
      boolean has​(Condition condition)
      immediately returns true if element matches given condition Method doesn't wait! WARNING: This method can help implementing crooks, but it is not needed for typical ui tests.
      SelenideElement hover()
      Emulate "mouseOver" event.
      java.lang.String innerHtml()
      Get the HTML code of the element with children.
      java.lang.String innerText()
      Get the text code of the element with children.
      boolean is​(Condition condition)
      immediately returns true if element matches given condition Method doesn't wait! WARNING: This method can help implementing crooks, but it is not needed for typical ui tests.
      boolean isDisplayed()
      Check if this element exists and visible.
      boolean isImage()
      Check if image is properly loaded.
      SelenideElement lastChild()
      Get last child element of this element ATTENTION! this method doesn't start any search yet! For example, $("tr").lastChild(); could give the last "td".
      java.lang.String name()
      Get the "name" attribute of the element
      SelenideElement parent()
      Get parent element of this element ATTENTION! This method doesn't start any search yet! For example, $("td").parent() could give some "tr".
      SelenideElement pressEnter()
      Press ENTER.
      SelenideElement pressEscape()
      Press ESCAPE.
      SelenideElement pressTab()
      Press TAB.
      java.io.File screenshot()
      Take screenshot of this element
      java.awt.image.BufferedImage screenshotAsImage()
      Take screenshot of this element
      SelenideElement scrollIntoView​(boolean alignToTop)
      Ask browser to scrolls the element on which it's called into the visible area of the browser window.
      SelenideElement scrollIntoView​(java.lang.String scrollIntoViewOptions)
      Ask browser to scrolls the element on which it's called into the visible area of the browser window.
      SelenideElement scrollTo()
      Ask browser to scroll to this element
      void selectOption​(int... index)
      Select an option from dropdown list (by index)
      void selectOption​(java.lang.String... text)
      Select an option from dropdown list (by text)
      void selectOptionByValue​(java.lang.String... value)
      Select an option from dropdown list (by value)
      void selectOptionContainingText​(java.lang.String text)
      Select an option from dropdown list that contains given text
      SelenideElement selectRadio​(java.lang.String value)
      Select radio button
      SelenideElement setSelected​(boolean selected)
      Set checkbox state to CHECKED or UNCHECKED.
      SelenideElement setValue​(java.lang.String text)
      Implementation details:
      SelenideElement should​(Condition... condition)
      Checks that given element meets all of given conditions.
      SelenideElement shouldBe​(Condition... condition)
      Synonym for #should.
      SelenideElement shouldHave​(Condition... condition)
      Synonym for #should.
      SelenideElement shouldNot​(Condition... condition)
      Checks that given element does not meet given conditions.
      SelenideElement shouldNotBe​(Condition... condition)
      Synonym for #shouldNot.
      SelenideElement shouldNotHave​(Condition... condition)
      Synonym for #shouldNot.
      java.lang.String text()
      Short form of getText()
      java.lang.String toString()
      Displays WebElement in human-readable format.
      org.openqa.selenium.WebElement toWebElement()  
      java.io.File uploadFile​(java.io.File... file)
      Upload file into file upload field.
      java.io.File uploadFromClasspath​(java.lang.String... fileName)
      Upload file into file upload field.
      java.lang.String val()
      Get the "value" attribute of the element Same as #getValue()
      SelenideElement val​(java.lang.String text)
      Same as #setValue(java.lang.String)
      SelenideElement waitUntil​(Condition condition, long timeoutMilliseconds)
      Wait until given element meets given conditions.
      SelenideElement waitUntil​(Condition condition, long timeoutMilliseconds, long pollingIntervalMilliseconds)
      Wait until given element meets given conditions.
      SelenideElement waitWhile​(Condition condition, long timeoutMilliseconds)
      Wait until given element does not meet given conditions.
      SelenideElement waitWhile​(Condition condition, long timeoutMilliseconds, long pollingIntervalMilliseconds)
      Wait until given element does not meet given conditions.
      • Methods inherited from interface org.openqa.selenium.interactions.Locatable

        getCoordinates
      • Methods inherited from interface org.openqa.selenium.TakesScreenshot

        getScreenshotAs
      • Methods inherited from interface org.openqa.selenium.WebElement

        clear, findElement, findElements, getAttribute, getCssValue, getLocation, getRect, getSize, getTagName, isEnabled, isSelected, sendKeys, submit
      • Methods inherited from interface org.openqa.selenium.WrapsDriver

        getWrappedDriver
    • Method Detail

      • setValue

        SelenideElement setValue​(java.lang.String text)
        Implementation details:

        If Configuration.versatileSetValue is true, can work as 'selectOptionByValue', 'selectRadio'

        If Configuration.fastSetValue is true, sets value by javascript instead of using Selenium built-in "sendKey" function and trigger "focus", "keydown", "keypress", "input", "keyup", "change" events.

        In other case behavior will be:

         1. WebElement.clear()
         2. WebElement.sendKeys(text)
         3. Trigger change event
         
        Parameters:
        text - Any text to enter into the text field or set by value for select/radio.
        See Also:
        SetValue
      • val

        SelenideElement val​(java.lang.String text)
        Same as #setValue(java.lang.String)
        See Also:
        Val
      • append

        SelenideElement append​(java.lang.String text)
        Append given test to the text field and trigger "change" event.

        Implementation details: This is the same as

           1. WebElement.sendKeys(text)
           2. Trigger change event
         

        Parameters:
        text - Any text to append into the text field.
        See Also:
        Append
      • pressEnter

        SelenideElement pressEnter()
        Press ENTER. Useful for input field and textareas:
          $("query").val("Aikido techniques").pressEnter();
        Implementation details: Check that element is displayed and execute
          WebElement.sendKeys(Keys.ENTER)
        See Also:
        PressEnter
      • pressTab

        SelenideElement pressTab()
        Press TAB. Useful for input field and textareas:
          $("#to").val("stiven@seagal.com").pressTab();
        Implementation details: Check that element is displayed and execute
          WebElement.sendKeys(Keys.TAB)
        See Also:
        PressTab
      • pressEscape

        SelenideElement pressEscape()
        Press ESCAPE. Useful for input field and textareas:
          $(".edit").click().pressEscape();
        Implementation details: Check that element is displayed and execute
          WebElement.sendKeys(Keys.ESCAPE)
        See Also:
        PressEscape
      • getText

        java.lang.String getText()
        Get the visible text of this element, including sub-elements without leading/trailing whitespace. NB! For "select", returns text(s) of selected option(s).
        Specified by:
        getText in interface org.openqa.selenium.WebElement
        Returns:
        The innerText of this element
        See Also:
        GetText
      • text

        java.lang.String text()
        Short form of getText()
        See Also:
        WebElement.getText(), GetText
      • innerText

        java.lang.String innerText()
        Get the text code of the element with children. Short form of getAttribute("textContent") or getAttribute("innerText") depending on browser.
        See Also:
        GetInnerText
      • innerHtml

        java.lang.String innerHtml()
        Get the HTML code of the element with children. Short form of getAttribute("innerHTML")
        See Also:
        GetInnerHtml
      • attr

        java.lang.String attr​(java.lang.String attributeName)
        Get the attribute of the element. Synonym for getAttribute(String).
        Returns:
        null if attribute is missing
        See Also:
        GetAttribute
      • name

        java.lang.String name()
        Get the "name" attribute of the element
        Returns:
        attribute "name" value or null if attribute is missing
        See Also:
        GetName
      • val

        java.lang.String val()
        Get the "value" attribute of the element Same as #getValue()
        Returns:
        attribute "value" value or null if attribute is missing
        See Also:
        Val
      • getValue

        java.lang.String getValue()
        Get the "value" attribute of the element
        Returns:
        attribute "value" value or null if attribute is missing
        Since:
        3.1
        See Also:
        GetValue
      • selectRadio

        SelenideElement selectRadio​(java.lang.String value)
        Select radio button
        Parameters:
        value - value of radio button to select
        Returns:
        selected "input type=radio" element
        See Also:
        SelectRadio
      • data

        java.lang.String data​(java.lang.String dataAttributeName)
        Get value of attribute "data-dataAttributeName"
        See Also:
        GetDataAttribute
      • exists

        boolean exists()
        Checks if element exists true on the current page.
        Returns:
        false if element is not found, browser is closed or any WebDriver exception happened
        See Also:
        Exists
      • isDisplayed

        boolean isDisplayed()
        Check if this element exists and visible.
        Specified by:
        isDisplayed in interface org.openqa.selenium.WebElement
        Returns:
        false if element does not exists, is invisible, browser is closed or any WebDriver exception happened.
        See Also:
        IsDisplayed
      • is

        boolean is​(Condition condition)
        immediately returns true if element matches given condition Method doesn't wait! WARNING: This method can help implementing crooks, but it is not needed for typical ui tests.
        See Also:
        has(com.codeborne.selenide.Condition), Matches
      • has

        boolean has​(Condition condition)
        immediately returns true if element matches given condition Method doesn't wait! WARNING: This method can help implementing crooks, but it is not needed for typical ui tests.
        See Also:
        is(com.codeborne.selenide.Condition), Matches
      • setSelected

        SelenideElement setSelected​(boolean selected)
        Set checkbox state to CHECKED or UNCHECKED.
        Parameters:
        selected - true for checked and false for unchecked
        See Also:
        SetSelected
      • should

        SelenideElement should​(Condition... condition)

        Checks that given element meets all of given conditions.

        IMPORTANT: If element does not match then conditions immediately, waits up to 4 seconds until element meets the conditions. It's extremely useful for dynamic content.

        Timeout is configurable via Configuration#timeout

        For example: $("#errorMessage").should(appear);

        Returns:
        Given element, useful for chaining: $("#errorMessage").should(appear).shouldBe(enabled);
        See Also:
        Configuration.timeout, Should
      • shouldNot

        SelenideElement shouldNot​(Condition... condition)

        Checks that given element does not meet given conditions.

        IMPORTANT: If element does match the conditions, waits up to 4 seconds until element does not meet the conditions. It's extremely useful for dynamic content.

        Timeout is configurable via Configuration#timeout

        For example: $("#errorMessage").should(exist);

        See Also:
        Configuration.timeout, ShouldNot
      • waitUntil

        SelenideElement waitUntil​(Condition condition,
                                  long timeoutMilliseconds)

        Wait until given element meets given conditions.

        IMPORTANT: in most cases you don't need this method because all should- methods wait too. You need to use #waitUntil or #waitWhile methods only if you need another timeout.

        Parameters:
        condition - e.g. enabled, visible, text() and so on
        timeoutMilliseconds - timeout in milliseconds.
        See Also:
        ShouldBe
      • waitUntil

        SelenideElement waitUntil​(Condition condition,
                                  long timeoutMilliseconds,
                                  long pollingIntervalMilliseconds)

        Wait until given element meets given conditions.

        IMPORTANT: in most cases you don't need this method because all should- methods wait too. You need to use #waitUntil or #waitWhile methods only if you need another timeout.

        Parameters:
        condition - e.g. enabled, visible, text() and so on
        timeoutMilliseconds - timeout in milliseconds.
        pollingIntervalMilliseconds - interval in milliseconds, when checking condition
        See Also:
        ShouldBe
      • waitWhile

        SelenideElement waitWhile​(Condition condition,
                                  long timeoutMilliseconds)

        Wait until given element does not meet given conditions.

        IMPORTANT: in most cases you don't need this method because all shouldNot- methods wait too. You need to use #waitUntil or #waitWhile methods only if you need another timeout.

        Parameters:
        condition - e.g. enabled, visible, text() and so on
        timeoutMilliseconds - timeout in milliseconds.
        See Also:
        ShouldNotBe
      • waitWhile

        SelenideElement waitWhile​(Condition condition,
                                  long timeoutMilliseconds,
                                  long pollingIntervalMilliseconds)

        Wait until given element does not meet given conditions.

        IMPORTANT: in most cases you don't need this method because all shouldNot- methods wait too. You need to use #waitUntil or #waitWhile methods only if you need another timeout.

        Parameters:
        condition - e.g. enabled, visible, text() and so on
        timeoutMilliseconds - timeout in milliseconds.
        pollingIntervalMilliseconds - interval in milliseconds, when checking condition
        See Also:
        ShouldNotBe
      • toString

        java.lang.String toString()
        Displays WebElement in human-readable format. Useful for logging and debugging. Not recommended to use for test verifications.
        Overrides:
        toString in class java.lang.Object
        Returns:
        e.g. Order has been confirmed
        See Also:
        ToString
      • parent

        SelenideElement parent()
        Get parent element of this element ATTENTION! This method doesn't start any search yet! For example, $("td").parent() could give some "tr".
        Returns:
        Parent element
        See Also:
        GetParent
      • lastChild

        SelenideElement lastChild()
        Get last child element of this element ATTENTION! this method doesn't start any search yet! For example, $("tr").lastChild(); could give the last "td".
      • closest

        SelenideElement closest​(java.lang.String tagOrClass)
        Locates closes ancestor element matching given criteria ATTENTION! This method doesn't start any search yet! For example, $("td").closest("table") could give some "table".
        Parameters:
        tagOrClass - Either HTML tag or CSS class. E.g. "form" or ".active".
        Returns:
        Matching ancestor element
        See Also:
        GetClosest
      • find

        SelenideElement find​(java.lang.String cssSelector)

        Locates the first matching element inside given element

        ATTENTION! This method doesn't start any search yet!

        Short form of webElement.findElement(By.cssSelector(cssSelector))

        See Also:
        Find
      • find

        SelenideElement find​(java.lang.String cssSelector,
                             int index)

        Locates the Nth matching element inside given element

        ATTENTION! This method doesn't start any search yet!
        See Also:
        Find
      • $x

        SelenideElement $x​(java.lang.String xpath)

        Locates the first matching element inside given element using xpath locator

        ATTENTION! This method doesn't start any search yet!

        Short form of webElement.findElement(By.xpath(xpathLocator))

        See Also:
        FindByXpath
      • $x

        SelenideElement $x​(java.lang.String xpath,
                           int index)

        Locates the Nth matching element inside given element using xpath locator

        ATTENTION! This method doesn't start any search yet!
        See Also:
        FindByXpath
      • findAll

        ElementsCollection findAll​(java.lang.String cssSelector)

        Short form of webDriver.findElements(thisElement, By.cssSelector(cssSelector))

        ATTENTION! This method doesn't start any search yet!

        For example, $("#multirowTable").findAll("tr.active").shouldHave(size(2));

        Returns:
        list of elements inside given element matching given CSS selector
        See Also:
        FindAll
      • findAll

        ElementsCollection findAll​(org.openqa.selenium.By selector)

        Short form of webDriver.findElements(thisElement, selector)

        ATTENTION! This method doesn't start any search yet!

        For example, $("#multirowTable").findAll(By.className("active")).shouldHave(size(2));

        Returns:
        list of elements inside given element matching given criteria
        See Also:
        FindAll
      • $$x

        ElementsCollection $$x​(java.lang.String xpath)

        Short form of webDriver.findElements(thisElement, By.xpath(xpath))

        ATTENTION! This method doesn't start any search yet!

        For example, $("#multirowTable").$$x("./input").shouldHave(size(2));

        Returns:
        list of elements inside given element matching given xpath locator
        See Also:
        FindAllByXpath
      • uploadFromClasspath

        java.io.File uploadFromClasspath​(java.lang.String... fileName)

        Upload file into file upload field. File is searched from classpath.

        Multiple file upload is also supported. Just pass as many file names as you wish.

        Parameters:
        fileName - name of the file or the relative path in classpath e.g. "files/1.pfd"
        Returns:
        the object of the first file uploaded
        Throws:
        java.lang.IllegalArgumentException - if any of the files is not found
        See Also:
        UploadFileFromClasspath
      • uploadFile

        java.io.File uploadFile​(java.io.File... file)

        Upload file into file upload field.

        Multiple file upload is also supported. Just pass as many files as you wish.

        Parameters:
        file - file object(s)
        Returns:
        the object of the first file uploaded
        Throws:
        java.lang.IllegalArgumentException - if any of the files is not found, or other errors
        See Also:
        UploadFile
      • selectOption

        void selectOption​(int... index)
        Select an option from dropdown list (by index)
        Parameters:
        index - 0..N (0 means first option)
        See Also:
        SelectOptionByTextOrIndex
      • selectOption

        void selectOption​(java.lang.String... text)
        Select an option from dropdown list (by text)
        Parameters:
        text - visible text of option
        See Also:
        SelectOptionByTextOrIndex
      • selectOptionContainingText

        void selectOptionContainingText​(java.lang.String text)
        Select an option from dropdown list that contains given text
        Parameters:
        text - substring of visible text of option
        See Also:
        SelectOptionContainingText
      • selectOptionByValue

        void selectOptionByValue​(java.lang.String... value)
        Select an option from dropdown list (by value)
        Parameters:
        value - "value" attribute of option
        See Also:
        SelectOptionByValue
      • getSelectedOption

        SelenideElement getSelectedOption()
                                   throws org.openqa.selenium.NoSuchElementException
        Find (first) selected option from this select field
        Returns:
        WebElement for selected <option> element
        Throws:
        org.openqa.selenium.NoSuchElementException - if no options are selected
        See Also:
        GetSelectedOption
      • getSelectedOptions

        ElementsCollection getSelectedOptions()
        Find all selected options from this select field
        Returns:
        ElementsCollection for selected <option> elements (empty list if no options are selected)
        See Also:
        GetSelectedOptions
      • getSelectedValue

        java.lang.String getSelectedValue()
        Get value of selected option in select field
        See Also:
        GetSelectedValue
      • getSelectedText

        java.lang.String getSelectedText()
        Get text of selected option in select field
        See Also:
        GetSelectedText
      • scrollIntoView

        SelenideElement scrollIntoView​(boolean alignToTop)
        Ask browser to scrolls the element on which it's called into the visible area of the browser window.

        If alignToTop boolean value is true - the top of the element will be aligned to the top.

        If alignToTop boolean value is false - the bottom of the element will be aligned to the bottom. Usage:

             element.scrollIntoView(true);
             // Corresponds to scrollIntoViewOptions: {block: "start", inline: "nearest"}
        
             element.scrollIntoView(false);
             // Corresponds to scrollIntoViewOptions: {block: "end", inline: "nearest"}
         
        Parameters:
        alignToTop - boolean value that indicate how element will be aligned to the visible area of the scrollable ancestor.
        See Also:
        ScrollIntoView, Web API reference
      • scrollIntoView

        SelenideElement scrollIntoView​(java.lang.String scrollIntoViewOptions)
        Ask browser to scrolls the element on which it's called into the visible area of the browser window.
         scrollIntoViewOptions:
          * behavior (optional) - Defines the transition animation
            1. auto (default)
            2. instant
            3. smooth
          * block (optional)
            1. start
            2. center (default)
            3. end
            4. nearest
          * inline
            1. start
            2. center
            3. end
            4. nearest (default)
         

        Usage:

             element.scrollIntoView("{block: \"end\"}");
             element.scrollIntoView("{behavior: \"instant\", block: \"end\", inline: \"nearest\"}");
         
        Parameters:
        scrollIntoViewOptions - is an object with the align properties: behavior, block and inline.
        See Also:
        ScrollIntoView, Web API reference
      • download

        java.io.File download()
                       throws java.io.FileNotFoundException
        Download file linked by "href" attribute of this element
        Throws:
        java.lang.RuntimeException - if 50x status code was returned from server
        java.io.FileNotFoundException - if 40x status code was returned from server
        See Also:
        DownloadFile
      • download

        java.io.File download​(long timeout)
                       throws java.io.FileNotFoundException
        Download file linked by "href" attribute of this element or any file to which this element redirects.
        Parameters:
        timeout - download operations timeout.
        Throws:
        java.lang.RuntimeException - if 50x status code was returned from server
        java.io.FileNotFoundException - if 40x status code was returned from server
        See Also:
        DownloadFile
      • getSearchCriteria

        java.lang.String getSearchCriteria()
        Return criteria by which this element is located
        Returns:
        e.g. "#multirowTable.findBy(text 'INVALID-TEXT')/valid-selector"
      • toWebElement

        org.openqa.selenium.WebElement toWebElement()
        Returns:
        the original Selenium WebElement wrapped by this object
        See Also:
        ToWebElement
      • getWrappedElement

        org.openqa.selenium.WebElement getWrappedElement()
        Specified by:
        getWrappedElement in interface org.openqa.selenium.WrapsElement
        Returns:
        Underlying WebElement
        See Also:
        GetWrappedElement
      • click

        void click()
        Click the element

        By default it uses default Selenium method click.

        But it uses JavaScript method to click if com.codeborne.selenide.Configuration#clickViaJs is defined. It may be helpful for testing in Internet Explorer where native click doesn't always work correctly.

        Specified by:
        click in interface org.openqa.selenium.WebElement
        See Also:
        Click
      • click

        void click​(int offsetX,
                   int offsetY)
        Click the element with a relative offset from the center of the element
      • contextClick

        SelenideElement contextClick()
        Click with right mouse button on this element
        Returns:
        this element
        See Also:
        ContextClick
      • hover

        SelenideElement hover()
        Emulate "mouseOver" event. In other words, move mouse cursor over this element (without clicking it).
        Returns:
        this element
        See Also:
        Hover
      • dragAndDropTo

        SelenideElement dragAndDropTo​(java.lang.String targetCssSelector)
        Drag and drop this element to the target Before dropping, waits until target element gets visible.
        Parameters:
        targetCssSelector - CSS selector defining target element
        Returns:
        this element
        See Also:
        DragAndDropTo
      • dragAndDropTo

        SelenideElement dragAndDropTo​(org.openqa.selenium.WebElement target)
        Drag and drop this element to the target Before dropping, waits until target element gets visible.
        Parameters:
        target - target element
        Returns:
        this element
        See Also:
        DragAndDropTo
      • execute

        <ReturnType> ReturnType execute​(Command<ReturnType> command)
        Execute custom implemented command
        Parameters:
        command - custom command
        Returns:
        this element
        See Also:
        Execute, Command
      • isImage

        boolean isImage()
        Check if image is properly loaded.
        Throws:
        java.lang.IllegalArgumentException - if argument is not an "img" element
        Since:
        2.13
        See Also:
        IsImage
      • screenshot

        java.io.File screenshot()
        Take screenshot of this element
        Returns:
        file with screenshot (*.png)
        See Also:
        TakeScreenshot
      • screenshotAsImage

        java.awt.image.BufferedImage screenshotAsImage()
        Take screenshot of this element
        Returns:
        buffered image with screenshot
        See Also:
        TakeScreenshotAsImage