Locating text
Brought to you by:
dgan
How do I find text on the web page.
For example, while login on a web page, the user enters
incorrect password, and the server returns an
error "Invalid Password " which is displayed on top of the
web page (not in a message box). How do I locate this
text?
Thanks
Logged In: YES
user_id=973398
Assuming you have set up a WebClient webClient and are on
the correct page:
WebResponse currentPage = webClient.getCurrentState();
if (currentPage.getText().indexOf("My search text") == -1) {
System.out.println("Text not found");
}
else {
System.out.println("Text found");
}