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 - Selenium Tutorial
From the course: Robot Framework Test Automation: Level 2
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…
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.
Contents
-
-
-
-
-
-
-
Web locators advanced overview1m 10s
-
(Locked)
Basic XPath and CSS syntax11m 24s
-
(Locked)
Absolute relationships (XPath and CSS)8m 23s
-
(Locked)
Relative relationships (XPath and CSS)9m 44s
-
(Locked)
Partial locators: starts-with5m 30s
-
(Locked)
Partial locators: ends-with2m 10s
-
(Locked)
Partial locators: contains8m 3s
-
(Locked)
Scenario: Find and use multiple elements5m 7s
-
-
-
-
-
-
-