com.codeborne.selenide.Selenide [src][javadoc]
The main class for using Selenide library. The basic methods areopen
,$
and$$
(import static com.codeborne.selenide.Selenide.* for readability):
- open(String URL) opens the browser
- $(String cssSelector) defines CSS locator, returns SelenideElement
- $(By) defines any other locator (id, name, text, xpath etc.) - returns SelenideElement
- $$(String cssSelector) defines CSS locator, returns collection of elements
- $$(By) returns collection of elements
Defining SelenideElement doesn’t trigger the search in DOM yet, so you can save the locators in variables for later use at any place. With a SelenideElement instance, you can either do action with it (click
,setValue
etc.) or check a condition:shouldHave(text("abc"))
. Both will trigger the search of the elements in DOM.
There is also a number of other less frequently used methods in Selenide class: sleep(), refresh() and title().