Answer the question
In order to leave comments, you need to log in
How to bring this code into a more beautiful form or into a switch case?
I am looking for a form by id
, name
, class
and action
which matches the regular expression.
If this is found, I pass the current WebElement to the direct method for further tests
. But the use confuses me if
- else if
since their number only increases with time.
if (formElements.getAttribute("action").matches(regexUser)) {
direct(formElements);
} else if (formElements.getAttribute("id").matches(regexMember)) {
direct(formElements);
} else if (formElements.getAttribute("name").matches(regexPeople)) {
direct(formElements);
} else if (formElements.getAttribute("class").matches(regexFollowers)) {
direct(formElements);
} else if (formElements.getAttribute("class").matches(regexUser)) {
direct(formElements);
} else {
System.out.println("Сегодня нету нужных форм...");
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question