Then I should see text matching "text pattern" in the "element" element

This step definition is used to test whether the specific element contains text that matches the specified pattern.

 

Then (I|we)* should see text matching "([^"]*)?" in the "([^"]*)?" element

 

There are many types of text that are searched such as email, phone number, link address path, time and date, uppercase or lowercase words, words with certain letters, and . . . etc.

 

Example:

Then I should see text matching "(((0[1-9])|(1[0-2])):([0-5])(0|5)\s(A|P|a|p)(M|m))" in the ".time" element

"(((0[1-9])|(1[0-2])):([0-5])(0|5)\s(A|P|a|p)(M|m))" It is a pattern that searches for a text that exists in an element that has a pattern match with the 12-hour time format. 

Ex. 10:30 AM