BO
Size: a a a
BO
AK
public SelenideElement should(Condition condition) {
return self.$("проверяемый_элемент").should(condition)
}YO
YO
BO
AK
BO
public class ExchangeRates {
private WebElement self;
private WebElement currencyRates = self.findElements(".foo");
public ExchangeRates(WebElement self) {
this.self = self;
}
public String getRates() {
return currencyRates.getText();
}
}BO
YO
public class MyPage {
private MyElement1 one = $(".q",MyElement1.class);
private MyElement2 two = $(".w",MyElement2.class);
private MyElement3 three = $(".e",MyElement3.class);
}
public interface MyElement3 implements SelenideElement {
private MyElement4 one = $(".r",MyElement4.class);
private MyElement5 two = $(".t",MyElement5.class);
}
public interface MyElement5 implements SelenideElement {
public void doSomething(String foo)
}
public interface MyElement4 implements SelenideElement {
public MyElement4 doOther(String foo)
}
Test:
new MyPage().getThree().getOne().doOther("wow").shouldHave(text("text"))BO
BO
YO
AK
public static class Table {
private final SelenideElement table;
public Table(SelenideElement table) {
this.table = table;
}
public Header header() {
return new Header(table.$("thead"));
}
public List<Row> rows() {
$(".....").shouldBe(Condition.exist);
return table.$$("tbody tr").stream().map(Row::new).collect(Collectors.toList());
}
public static class Header {
private final SelenideElement header;
public Header(SelenideElement header) {this.header = header;}
}
public static class Row {
private SelenideElement row;
public Row(SelenideElement row) {this.row = row;}
@Step()
public ModalPage openModal() {
domain().click();
new ModalPage().title().shouldBe(visible, Duration.ofSeconds(10));
return new ModalPage();
}
public SelenideElement domain() {return row.$$("td").get(0);}
}
}AK
BO
BO
AS
AS
AS
YO