From the course: Selenium Essential Training

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Text matching

Text matching - Selenium Tutorial

From the course: Selenium Essential Training

Start my 1-month free trial

Text matching

- [Instructor] When there are no descriptive selectors, matching by text can come to the rescue. The two best ways to use a CSS selector based on text are by value, which will match text by exact value, there's also wildcard, which will match text based on a selector or part of a selector. In the last video I showed an example of finding a radio button based on its value. Just as a refresher, it looks like driver dot find element by CSS selector, and then inside of quotes specifying the tag name, and inside of brackets specifying the type and setting that equal to its value. As long as an element has a tag name and a value, those can be used to locate the element successfully. If it becomes necessary to match text using a CSS selector, I recommend using the element's value first. If the value's not available for some reason, matching text by wildcard is also acceptable. Here are the ways that we can match based on string…

Contents