From the course: Robot Framework Test Automation: Level 2

Unlock this course with a free trial

Join today to access over 24,900 courses taught by industry experts.

Partial locators: contains

Partial locators: contains

- [Narrator] So this is the third video in this series of our partial locator series, and now we're going to talk about finding a static portion of the attribute value regardless of whether it's at the beginning or the middle or the end. In XPath, this is done using the contains function instead of starts with or ends with, and you can see the syntax is very much the same as starts with, end with. You simply add the contains function and replace the equal sign with a comma. CSS is just as easy as it always has been. We're simply going to use an asterisk, which is widely known as a wild card character along with our equal sign. Let's try it out. So we'll stick with this search button. I'll inspect in FirePath, flip over to Xpath, and as you know by now, we can very quickly build this up ourselves by typing in input, at, type, equals, submit. So now we've got our one matching node and our slide here shows that we need to use this contains function with the parentheses and the comma…

Contents