From the course: Selenium Essential Training
Unlock the full course today
Join today to access over 24,000 courses taught by industry experts.
Text matching - Selenium Tutorial
From the course: Selenium Essential Training
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…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.