com.codeborne.selenide.Selectors [src]
The class contains some By
selectors to locate elements by text or attributes (that may be missed in standard Selenium WebDriver API):
byText
- search element by exact textwithText
- search element by contained text (substring)byTitle
- search by attribute "title"byValue
- search by attribute "value"by(attributeName, attributeValue)
- search by attribute's name and valuebyXpath
- etc.
// Examples:
$(byText("Login")).shouldBe(visible));
$(By.xpath("//div[text()='Login']")).shouldBe(visible); // any org.openqa.selenium.By.* selector can be used
$(byXpath("//div[text()='Login']")).shouldBe(visible); // or any its alternative from Selectors class