Interface SelenideAppiumElement
- All Superinterfaces:
org.openqa.selenium.interactions.Locatable,org.openqa.selenium.SearchContext,SelenideElement,org.openqa.selenium.TakesScreenshot,org.openqa.selenium.WebElement,org.openqa.selenium.WrapsDriver,org.openqa.selenium.WrapsElement
-
Method Summary
Modifier and TypeMethodDescriptionSame asSelenideElement.find(String)$(org.openqa.selenium.By selector) Same asSelenideElement.find(String)$(org.openqa.selenium.By selector, int index) Same asSelenideElement.findAll(String)$$(org.openqa.selenium.By selector) Same asSelenideElement.findAll(By)Short form ofwebDriver.findElements(thisElement, By.xpath(xpath))Locates the first matching element inside given element using xpath locatorLocates the Nth matching element inside given element using xpath locatorAppend given text to the text field and trigger "change" event.Give this element a human-readable name Caution: you probably don't need this method.click(ClickOptions clickOption) Click the element usingClickOptions:Click with right mouse button on this elementDouble-click the element
Before clicking, waits until element gets interactable and enabled.doubleClick(ClickOptions clickOption) Double-click the element usingClickOptions:$("#username").doubleClick(ClickOptions.usingJavaScript())dragAndDrop(DragAndDropOptions options) Drag and drop this element to the target
Before dropping, waits until target element gets visible.Locates the first matching element inside given elementLocates the Nth matching element inside given elementfind(org.openqa.selenium.By selector) Same asSelenideElement.find(String)find(org.openqa.selenium.By selector, int index) Short form ofwebDriver.findElements(thisElement, By.cssSelector(cssSelector))findAll(org.openqa.selenium.By selector) Short form ofwebDriver.findElements(thisElement, selector)highlight(HighlightOptions options) hover()Emulate "mouseOver" event.hover(HoverOptions options) Emulate "mouseOver" event.paste()Append text from clipboard to the text field and trigger "change" event.press(CharSequence... keysToPress) Press a Key(s) on Keyboard:Press ENTER.Press ESCAPE.pressTab()Press TAB.scroll(AppiumScrollOptions appiumScrollOptions) scroll(ScrollOptions scrollOptions) Scrolls the element by a specified distance in a specified direction.Scroll element vertically to the center of viewport.scrollIntoView(ScrollIntoViewOptions options) For example:scrollTo()Ask browser to scroll to this element The scrolling is performed instantly (ignoring CSS property "scroll-behavior: smooth").setSelected(boolean selected) Set checkbox state to CHECKED or UNCHECKED.Set value to given input element.setValue(SetValueOptions options) Similar toSelenideElement.setValue(java.lang.String)should(WebElementCondition... condition) Sequentially checks that given element meets all given conditions.should(WebElementCondition condition, Duration timeout) Wait until given element meets given condition (with given timeout)shouldBe(WebElementCondition... condition) Synonym forSelenideElement.should(WebElementCondition...).shouldBe(WebElementCondition condition, Duration timeout) Wait until given element meets given condition (with given timeout)shouldHave(WebElementCondition... condition) Synonym forSelenideElement.should(WebElementCondition...).shouldHave(WebElementCondition condition, Duration timeout) Wait until given element meets given condition (with given timeout)shouldNot(WebElementCondition... condition) Sequentially checks that given element does not meet given conditions.shouldNot(WebElementCondition condition, Duration timeout) Wait until given element meets given condition (with given timeout)shouldNotBe(WebElementCondition... condition) Synonym forSelenideElement.shouldNot(WebElementCondition...).shouldNotBe(WebElementCondition condition, Duration timeout) Wait until given element does NOT meet given condition (with given timeout)shouldNotHave(WebElementCondition... condition) Synonym forSelenideElement.shouldNot(WebElementCondition...).shouldNotHave(WebElementCondition condition, Duration timeout) Wait until given element does NOT meet given condition (with given timeout)swipe(AppiumSwipeOptions appiumSwipeOptions) swipeTo()tap()tap(AppiumClickOptions appiumClickOptions) type(TypeOptions options) Similar toSelenideElement.type(java.lang.CharSequence)type(CharSequence text) Mimic how real user would type in a text field Useful to work with autosuggestion dropdownunfocus()Remove focus from this elementval(SetValueOptions options) Methods inherited from interface org.openqa.selenium.interactions.Locatable
getCoordinatesMethods inherited from interface com.codeborne.selenide.SelenideElement
ancestor, ancestor, attr, cached, clear, click, closest, data, describe, download, download, download, download, download, downloadFiles, execute, execute, execute, exists, getAlias, getAttribute, getCssValue, getOptions, getOwnText, getSearchCriteria, getSelectedOption, getSelectedOptions, getSelectedOptionText, getSelectedOptionValue, getText, getValue, getWrappedElement, has, has, innerHtml, innerText, is, is, isDisplayed, isImage, lastChild, name, options, parent, preceding, pseudo, pseudo, screenshot, screenshotAsImage, scrollIntoView, scrollIntoView, selectOption, selectOption, selectOptionByValue, selectOptionContainingText, selectRadio, sibling, text, toString, toWebElement, uploadFile, uploadFromClasspath, valMethods inherited from interface org.openqa.selenium.TakesScreenshot
getScreenshotAsMethods inherited from interface org.openqa.selenium.WebElement
findElement, findElements, getAccessibleName, getAriaRole, getDomAttribute, getDomProperty, getLocation, getRect, getShadowRoot, getSize, getTagName, isEnabled, isSelected, sendKeys, submitMethods inherited from interface org.openqa.selenium.WrapsDriver
getWrappedDriver
-
Method Details
-
as
Description copied from interface:SelenideElementGive this element a human-readable name Caution: you probably don't need this method. It's always a good idea to have the actual selector instead of "nice" description (which might be misleading or even lying).- Specified by:
asin interfaceSelenideElement- Parameters:
alias- a human-readable name of this element (null or empty string not allowed)- Returns:
- this element
- See Also:
-
hideKeyboard
- See Also:
-
scrollTo
Description copied from interface:SelenideElementAsk browser to scroll to this element The scrolling is performed instantly (ignoring CSS property "scroll-behavior: smooth").- Specified by:
scrollToin interfaceSelenideElement- See Also:
-
scroll
- See Also:
-
swipeTo
- See Also:
-
swipe
- See Also:
-
tap
- See Also:
-
tap
- See Also:
-
doubleTap
- See Also:
-
shouldNotBe
@CanIgnoreReturnValue SelenideAppiumElement shouldNotBe(WebElementCondition condition, Duration timeout) Description copied from interface:SelenideElementWait until given element does NOT meet given condition (with given timeout)- Specified by:
shouldNotBein interfaceSelenideElement- See Also:
-
shouldNotBe
Description copied from interface:SelenideElementSynonym forSelenideElement.shouldNot(WebElementCondition...). Useful for better readability.For example:
$("#errorMessage").shouldNotBe(visible, enabled);- Specified by:
shouldNotBein interfaceSelenideElement- See Also:
-
shouldNotHave
@CanIgnoreReturnValue SelenideAppiumElement shouldNotHave(WebElementCondition condition, Duration timeout) Description copied from interface:SelenideElementWait until given element does NOT meet given condition (with given timeout)- Specified by:
shouldNotHavein interfaceSelenideElement- See Also:
-
shouldNotHave
Description copied from interface:SelenideElementSynonym forSelenideElement.shouldNot(WebElementCondition...). Useful for better readability.For example:
$("#errorMessage").shouldNotHave(text("Exception"), text("Error"));- Specified by:
shouldNotHavein interfaceSelenideElement- See Also:
-
shouldNot
@CanIgnoreReturnValue SelenideAppiumElement shouldNot(WebElementCondition condition, Duration timeout) Description copied from interface:SelenideElementWait until given element meets given condition (with given timeout)- Specified by:
shouldNotin interfaceSelenideElement- See Also:
-
shouldNot
Description copied from interface:SelenideElementSequentially 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.timeoutFor example:
$("#errorMessage").should(exist);- Specified by:
shouldNotin interfaceSelenideElement- See Also:
-
shouldBe
@CanIgnoreReturnValue SelenideAppiumElement shouldBe(WebElementCondition condition, Duration timeout) Description copied from interface:SelenideElementWait until given element meets given condition (with given timeout)- Specified by:
shouldBein interfaceSelenideElement- See Also:
-
shouldBe
Description copied from interface:SelenideElementSynonym forSelenideElement.should(WebElementCondition...). Useful for better readability.For example:
$("#errorMessage").shouldBe(visible, enabled);- Specified by:
shouldBein interfaceSelenideElement- See Also:
-
shouldHave
@CanIgnoreReturnValue SelenideAppiumElement shouldHave(WebElementCondition condition, Duration timeout) Description copied from interface:SelenideElementWait until given element meets given condition (with given timeout)- Specified by:
shouldHavein interfaceSelenideElement- See Also:
-
shouldHave
Description copied from interface:SelenideElementSynonym forSelenideElement.should(WebElementCondition...). Useful for better readability.For example:
$("#errorMessage").shouldHave(text("Hello"), text("World"));- Specified by:
shouldHavein interfaceSelenideElement- See Also:
-
should
Description copied from interface:SelenideElementWait until given element meets given condition (with given timeout)- Specified by:
shouldin interfaceSelenideElement- See Also:
-
should
Description copied from interface:SelenideElementSequentially checks that given element meets all 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.timeoutFor example:
$("#errorMessage").should(appear);- Specified by:
shouldin interfaceSelenideElement- Returns:
- Given element, useful for chaining:
$("#errorMessage").should(appear).shouldBe(enabled); - See Also:
-
find
Description copied from interface:SelenideElementLocates the first matching element inside given elementShort form of
webElement.findElement(By.cssSelector(cssSelector))- Specified by:
findin interfaceSelenideElement- See Also:
-
find
Description copied from interface:SelenideElementLocates the Nth matching element inside given element- Specified by:
findin interfaceSelenideElement- See Also:
-
find
Description copied from interface:SelenideElementSame asSelenideElement.find(String)- Specified by:
findin interfaceSelenideElement- See Also:
-
find
Description copied from interface:SelenideElement- Specified by:
findin interfaceSelenideElement- See Also:
-
$
Description copied from interface:SelenideElementSame asSelenideElement.find(String)- Specified by:
$in interfaceSelenideElement- See Also:
-
$
Description copied from interface:SelenideElement- Specified by:
$in interfaceSelenideElement- See Also:
-
$
Description copied from interface:SelenideElementSame asSelenideElement.find(String)- Specified by:
$in interfaceSelenideElement- See Also:
-
$
Description copied from interface:SelenideElement- Specified by:
$in interfaceSelenideElement- See Also:
-
$x
Description copied from interface:SelenideElementLocates the first matching element inside given element using xpath locatorShort form of
webElement.findElement(By.xpath(xpathLocator))- Specified by:
$xin interfaceSelenideElement- See Also:
-
$x
Description copied from interface:SelenideElementLocates the Nth matching element inside given element using xpath locator- Specified by:
$xin interfaceSelenideElement- See Also:
-
findAll
Description copied from interface:SelenideElementShort form ofwebDriver.findElements(thisElement, By.cssSelector(cssSelector))For example,
$("#multirowTable").findAll("tr.active").shouldHave(size(2));- Specified by:
findAllin interfaceSelenideElement- Returns:
- list of elements inside given element matching given CSS selector
- See Also:
-
findAll
Description copied from interface:SelenideElementShort form ofwebDriver.findElements(thisElement, selector)For example,
$("#multirowTable").findAll(By.className("active")).shouldHave(size(2));- Specified by:
findAllin interfaceSelenideElement- Returns:
- list of elements inside given element matching given criteria
- See Also:
-
$$
Description copied from interface:SelenideElementSame asSelenideElement.findAll(String)- Specified by:
$$in interfaceSelenideElement- See Also:
-
$$
Description copied from interface:SelenideElementSame asSelenideElement.findAll(By)- Specified by:
$$in interfaceSelenideElement
-
$$x
Description copied from interface:SelenideElementShort form ofwebDriver.findElements(thisElement, By.xpath(xpath))For example,
$("#multirowTable").$$x("./input").shouldHave(size(2));- Specified by:
$$xin interfaceSelenideElement- Returns:
- list of elements inside given element matching given xpath locator
- See Also:
-
setValue
Description copied from interface:SelenideElementSet value to given input element.Applicable for::
<input>and<textarea>.Implementation details:
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
- Specified by:
setValuein interfaceSelenideElement- Parameters:
text- Any text to enter into the text field or set by value for select/radio.- See Also:
-
setValue
Description copied from interface:SelenideElementSimilar toSelenideElement.setValue(java.lang.String)- Specified by:
setValuein interfaceSelenideElement- See Also:
-
val
Description copied from interface:SelenideElement- Specified by:
valin interfaceSelenideElement- See Also:
-
val
Description copied from interface:SelenideElement- Specified by:
valin interfaceSelenideElement- See Also:
-
type
Description copied from interface:SelenideElementMimic how real user would type in a text field Useful to work with autosuggestion dropdown- Specified by:
typein interfaceSelenideElement- See Also:
-
type
Description copied from interface:SelenideElementSimilar toSelenideElement.type(java.lang.CharSequence)- Specified by:
typein interfaceSelenideElement- Parameters:
options- parameters specifying how exactly you want to type the text- See Also:
-
append
Description copied from interface:SelenideElementAppend given text to the text field and trigger "change" event.Applicable for:
<input>and<textarea>.Implementation details:
This is the same as
1. WebElement.sendKeys(text) 2. Trigger change event
- Specified by:
appendin interfaceSelenideElement- Parameters:
text- Any text to append into the text field.- See Also:
-
paste
Description copied from interface:SelenideElementAppend text from clipboard to the text field and trigger "change" event.- Specified by:
pastein interfaceSelenideElement- See Also:
-
press
Description copied from interface:SelenideElementPress a Key(s) on Keyboard:$(".edit").press(Keys.DOWN).click();Implementation details:
Checks that element is displayed and executes
WebElement.sendKeys(keysToPress)
Compared toWebElement.sendKeys(CharSequence...), this method is chainable.- Specified by:
pressin interfaceSelenideElement- See Also:
-
PressKeys
-
pressEnter
Description copied from interface:SelenideElementPress ENTER. Useful for input field and textareas:$("query").val("Dear Santa").pressEnter();Implementation details: Check that element is displayed and execute
WebElement.sendKeys(Keys.ENTER)
- Specified by:
pressEnterin interfaceSelenideElement- See Also:
-
pressEscape
Description copied from interface:SelenideElementPress ESCAPE. Useful for input field and textareas:$(".edit").click().pressEscape();Implementation details:
Check that element is displayed and execute
WebElement.sendKeys(Keys.ESCAPE)
- Specified by:
pressEscapein interfaceSelenideElement- See Also:
-
pressTab
Description copied from interface:SelenideElementPress TAB. Useful for input field and text areas:$("#to").val("santa@claus.fi").pressTab();Implementation details:
Check that element is displayed and execute
WebElement.sendKeys(Keys.TAB)
- Specified by:
pressTabin interfaceSelenideElement- See Also:
-
unfocus
Description copied from interface:SelenideElementRemove focus from this element- Specified by:
unfocusin interfaceSelenideElement- See Also:
-
setSelected
Description copied from interface:SelenideElementSet checkbox state to CHECKED or UNCHECKED.- Specified by:
setSelectedin interfaceSelenideElement- Parameters:
selected- true for checked and false for unchecked- See Also:
-
click
Description copied from interface:SelenideElementClick the element usingClickOptions:
You can specify a relative offset from the center of the element inside ClickOptions: e.g.$("#username").click(ClickOptions.usingJavaScript())
Before clicking, waits until element gets interactable and enabled.$("#username").click(usingJavaScript().offset(123, 222))- Specified by:
clickin interfaceSelenideElement- Returns:
- this element
- See Also:
-
contextClick
Description copied from interface:SelenideElementClick with right mouse button on this element- Specified by:
contextClickin interfaceSelenideElement- Returns:
- this element
- See Also:
-
doubleClick
Description copied from interface:SelenideElementDouble-click the element
Before clicking, waits until element gets interactable and enabled.- Specified by:
doubleClickin interfaceSelenideElement- Returns:
- this element
- See Also:
-
doubleClick
Description copied from interface:SelenideElementDouble-click the element usingClickOptions:$("#username").doubleClick(ClickOptions.usingJavaScript())You can specify a relative offset from the center of the element inside ClickOptions: e.g.
$("#username").doubleClick(usingJavaScript().offset(123, 222))
Before clicking, waits until element gets interactable and enabled.- Specified by:
doubleClickin interfaceSelenideElement- Returns:
- this element
- See Also:
-
hover
Description copied from interface:SelenideElementEmulate "mouseOver" event. In other words, move mouse cursor over this element (without clicking it).- Specified by:
hoverin interfaceSelenideElement- Returns:
- this element
- See Also:
-
hover
Description copied from interface:SelenideElementEmulate "mouseOver" event. In other words, move mouse cursor over this element (without clicking it).- Specified by:
hoverin interfaceSelenideElement- Parameters:
options- optional hover parameters (offset etc)- Returns:
- this element
- See Also:
-
dragAndDrop
Description copied from interface:SelenideElementDrag and drop this element to the target
Before dropping, waits until target element gets visible.
Examples:
using a CSS selector defining the target element:
$("#element").dragAndDrop(to("#target"))
using a SelenideElement defining the target element:
$("#element").dragAndDrop(to($("#target")))
define which way it will be executed:
usingJavaScript(by default):
$("#element").dragAndDrop(to("#target").usingJS())
usingActions:
$("#element").dragAndDrop(to("#target").usingSeleniumActions())
/ *- Specified by:
dragAndDropin interfaceSelenideElement- Parameters:
options- drag and drop options to define target and which way it will be executed- Returns:
- this element
- See Also:
-
scroll
Description copied from interface:SelenideElementScrolls the element by a specified distance in a specified direction.It takes
ScrollOptionsto specify the direction, distance and other options. For example, if you want to scroll the element down by 100 pixels, you can do:
If you want to scroll the element right by 250 pixels, you can do:element.scroll(direction(DOWN).distance(100))
The scrolling is performed instantly (ignoring CSS property "scroll-behavior: smooth").element.scroll(direction(RIGHT).distance(250))- Specified by:
scrollin interfaceSelenideElement- Parameters:
scrollOptions- direction, distance etc.- See Also:
-
scrollIntoView
Description copied from interface:SelenideElementFor example:$(".logo").scrollIntoView(instant().block(center).inline(end));- Specified by:
scrollIntoViewin interfaceSelenideElement- See Also:
-
scrollIntoCenter
Description copied from interface:SelenideElementScroll element vertically to the center of viewport. The scrolling is performed instantly (ignoring CSS property "scroll-behavior: smooth"). Same as$.scrollIntoView("{block: 'center', behavior: 'instant'}")- Specified by:
scrollIntoCenterin interfaceSelenideElement- See Also:
-
highlight
- Specified by:
highlightin interfaceSelenideElement- See Also:
-
highlight
- Specified by:
highlightin interfaceSelenideElement- See Also:
-
unhighlight
- Specified by:
unhighlightin interfaceSelenideElement- See Also:
-