I'm working on Selenium and when I do the GetText message I get something like this:
String message = driver.findElement (By.Xpath ("IdMessage")). getText ();
And in the message variable the following is captured:
Mensaje aceptado correctamente
then I need to take the word "correctly" only, but I will not do it with the substring action that has java because sometimes they add or remove things from that message, but by user rule always the word should remain correctly in the message.
I am doing a conditional if to say that if my variable message brings the word correctly , I will do certain actions promptly.
Question: Does Java have any way to obtain from a String string only the punctual text that is required?