I am writing a method that simplifies reading the code and can’t do it in any way so that it is universal

public class Pages { public void searchByText(String text) { $(byText(text)); } 

}

 pages.searchByText("Текст"); 

But I want to make it so that you can work with the methods of the selenide itself through your method

THOSE. like this> pages.searchByText("Текст").shouldBe(visible);

    1 answer 1

    If it is absolutely universal to do so that there is one method - something like this:

     public SelenideElement SearchElement(SearchBy by, string value) { switch (by) { ... } } 

    Where SearchBy is enum with all the good that you want to use as a search.

    Well, the person through intellisense himself chooses what to use for the search and passes the value, and the implementation is concrete in the switch already.