From the course: Selenium Essential Training

Unlock the full course today

Join today to access over 23,200 courses taught by industry experts.

Text matching

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