public class Selenide
extends java.lang.Object
Constructor and Description |
---|
Selenide() |
Modifier and Type | Method and Description |
---|---|
static SelenideElement |
$(org.openqa.selenium.By seleniumSelector)
Find the first element matching given CSS selector
|
static SelenideElement |
$(org.openqa.selenium.By seleniumSelector,
int index) |
static SelenideElement |
$(java.lang.String cssSelector)
Find the first element matching given CSS selector
|
static SelenideElement |
$(java.lang.String cssSelector,
int index)
Find the Nth element matching given criteria
|
static SelenideElement |
$(org.openqa.selenium.WebElement webElement)
Wrap standard Selenium WebElement into SelenideElement to use additional methods like shouldHave(), selectOption() etc.
|
protected static SelenideElement |
$(org.openqa.selenium.WebElement parent,
org.openqa.selenium.By selector,
int index) |
static SelenideElement |
$(org.openqa.selenium.WebElement parent,
java.lang.String cssSelector)
Find the first element matching given CSS selector
|
static SelenideElement |
$(org.openqa.selenium.WebElement parent,
java.lang.String cssSelector,
int index)
Find the Nth element matching given criteria
|
static ElementsCollection |
$$(org.openqa.selenium.By seleniumSelector)
Find all elements matching given CSS selector.
|
static ElementsCollection |
$$(java.util.Collection<? extends org.openqa.selenium.WebElement> elements) |
static ElementsCollection |
$$(java.lang.String cssSelector)
Find all elements matching given CSS selector.
|
static ElementsCollection |
$$(org.openqa.selenium.WebElement parent,
org.openqa.selenium.By seleniumSelector)
Find all elements matching given criteria inside given parent element
|
static ElementsCollection |
$$(org.openqa.selenium.WebElement parent,
java.lang.String cssSelector)
Find all elements matching given CSS selector inside given parent element
Methods returns an ElementsCollection which is a list of WebElement objects that can be iterated,
and at the same time is implementation of WebElement interface, meaning that you can call methods .sendKeys(), click() etc.
|
static org.openqa.selenium.interactions.Actions |
actions()
With this method you can use Selenium Actions like described in the
AdvancedUserInteractions page.
|
static void |
confirm(java.lang.String expectedConfirmationText)
Accept (Click "Yes" or "Ok") in the confirmation dialog (javascript 'alert' or 'confirm').
|
static void |
dismiss(java.lang.String expectedConfirmationText)
Dismiss (click "No" or "Cancel") in the confirmation dialog (javascript 'alert' or 'confirm').
|
static java.lang.Object |
executeJavaScript(java.lang.String jsCode) |
static SelenideElement |
getElement(org.openqa.selenium.By criteria)
Find the first element matching given criteria
|
static SelenideElement |
getElement(org.openqa.selenium.By criteria,
int index)
Find the Nth element matching given criteria
|
static ElementsCollection |
getElements(org.openqa.selenium.By criteria)
Find all elements matching given CSS selector
|
static org.openqa.selenium.WebElement |
getFocusedElement() |
static SelenideElement |
getSelectedRadio(org.openqa.selenium.By radioField) |
static void |
open(java.lang.String relativeOrAbsoluteUrl) |
static <PageObjectClass> |
open(java.lang.String relativeOrAbsoluteUrl,
java.lang.Class<PageObjectClass> pageObjectClassClass) |
static void |
open(java.net.URL absoluteUrl) |
static <PageObjectClass> |
open(java.net.URL absoluteUrl,
java.lang.Class<PageObjectClass> pageObjectClassClass) |
static <PageObjectClass> |
page(java.lang.Class<PageObjectClass> pageObjectClass)
Create a Page Object instance.
|
static <PageObjectClass,T extends PageObjectClass> |
page(T pageObject)
Create a Page Object instance.
|
static void |
refresh()
Reload current page
|
static SelenideElement |
selectRadio(org.openqa.selenium.By radioField,
java.lang.String value)
Select radio field by value
|
static void |
sleep(long milliseconds)
Not recommended.
|
static org.openqa.selenium.WebDriver.TargetLocator |
switchTo() |
static java.lang.String |
title() |
static org.openqa.selenium.support.ui.FluentWait<org.openqa.selenium.WebDriver> |
Wait() |
public static Navigator navigator
public static void open(java.lang.String relativeOrAbsoluteUrl)
public static void open(java.net.URL absoluteUrl)
public static <PageObjectClass> PageObjectClass open(java.lang.String relativeOrAbsoluteUrl, java.lang.Class<PageObjectClass> pageObjectClassClass)
public static <PageObjectClass> PageObjectClass open(java.net.URL absoluteUrl, java.lang.Class<PageObjectClass> pageObjectClassClass)
public static void refresh()
public static java.lang.String title()
public static void sleep(long milliseconds)
milliseconds
- Time to sleep in millisecondspublic static SelenideElement $(org.openqa.selenium.WebElement webElement)
webElement
- standard Selenium WebElementpublic static SelenideElement $(java.lang.String cssSelector)
cssSelector
- any CSS selector like "input[name='first_name']" or "#messages .new_message"org.openqa.selenium.NoSuchElementException
- if element was no foundpublic static SelenideElement $(org.openqa.selenium.By seleniumSelector)
seleniumSelector
- any Selenium selector like By.id(), By.name() etc.org.openqa.selenium.NoSuchElementException
- if element was no foundpublic static SelenideElement $(org.openqa.selenium.By seleniumSelector, int index)
public static SelenideElement $(org.openqa.selenium.WebElement parent, java.lang.String cssSelector)
parent
- the WebElement to search elements incssSelector
- any CSS selector like "input[name='first_name']" or "#messages .new_message"org.openqa.selenium.NoSuchElementException
- if element was no foundpublic static SelenideElement $(java.lang.String cssSelector, int index)
cssSelector
- any CSS selector like "input[name='first_name']" or "#messages .new_message"index
- 0..Norg.openqa.selenium.NoSuchElementException
- if element was no foundpublic static SelenideElement $(org.openqa.selenium.WebElement parent, java.lang.String cssSelector, int index)
parent
- the WebElement to search elements incssSelector
- any CSS selector like "input[name='first_name']" or "#messages .new_message"index
- 0..Norg.openqa.selenium.NoSuchElementException
- if element was no foundprotected static SelenideElement $(org.openqa.selenium.WebElement parent, org.openqa.selenium.By selector, int index)
public static ElementsCollection $$(java.util.Collection<? extends org.openqa.selenium.WebElement> elements)
public static ElementsCollection $$(java.lang.String cssSelector)
cssSelector
- any CSS selector like "input[name='first_name']" or "#messages .new_message"public static ElementsCollection $$(org.openqa.selenium.By seleniumSelector)
seleniumSelector
- any Selenium selector like By.id(), By.name() etc.public static ElementsCollection $$(org.openqa.selenium.WebElement parent, java.lang.String cssSelector)
parent
- the WebElement to search elements incssSelector
- any CSS selector like "input[name='first_name']" or "#messages .new_message"public static ElementsCollection $$(org.openqa.selenium.WebElement parent, org.openqa.selenium.By seleniumSelector)
public static SelenideElement getElement(org.openqa.selenium.By criteria)
criteria
- instance of By: By.id(), By.className() etc.org.openqa.selenium.NoSuchElementException
- if element was no foundpublic static SelenideElement getElement(org.openqa.selenium.By criteria, int index)
criteria
- instance of By: By.id(), By.className() etc.index
- 0..Norg.openqa.selenium.NoSuchElementException
- if element was no foundpublic static ElementsCollection getElements(org.openqa.selenium.By criteria)
criteria
- instance of By: By.id(), By.className() etc.public static java.lang.Object executeJavaScript(java.lang.String jsCode)
public static SelenideElement selectRadio(org.openqa.selenium.By radioField, java.lang.String value)
radioField
- any By selector for finding radio fieldvalue
- value to select (should match an attribute "value")public static SelenideElement getSelectedRadio(org.openqa.selenium.By radioField)
public static void confirm(java.lang.String expectedConfirmationText)
expectedConfirmationText
- if not null, check that confirmation dialog displays this message (case-sensitive)java.lang.AssertionError
- if confirmation message differs from expected messagepublic static void dismiss(java.lang.String expectedConfirmationText)
expectedConfirmationText
- if not null, check that confirmation dialog displays this message (case-sensitive)java.lang.AssertionError
- if confirmation message differs from expected messagepublic static org.openqa.selenium.WebDriver.TargetLocator switchTo()
public static org.openqa.selenium.WebElement getFocusedElement()
public static <PageObjectClass> PageObjectClass page(java.lang.Class<PageObjectClass> pageObjectClass)
PageFactory.initElements(org.openqa.selenium.WebDriver, Class)
public static <PageObjectClass,T extends PageObjectClass> PageObjectClass page(T pageObject)
PageFactory.initElements(org.openqa.selenium.WebDriver, Class)
public static org.openqa.selenium.support.ui.FluentWait<org.openqa.selenium.WebDriver> Wait()
public static org.openqa.selenium.interactions.Actions actions()
actions() .sendKeys($(By.name("rememberMe")), "John") .click($(#rememberMe")) .click($(byText("Login"))) .build() .perform();