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.
Using wildcards - Selenium Tutorial
From the course: Selenium Essential Training
Using wildcards
- [Instructor] Using child nodes are helpful when it is difficult to find a unique and descriptive locator for an element. There are a couple ways in which we might want to go about finding child nodes. Either using the child node which is a node directly under another node or the nth-child which is used when there are multiple nodes at the same level under another node. I'll first talk about an example of finding a child node. Take for example the following HTML where there is a div tag and directly under that, an a tag. To find the child element the selector would be driver.findElement(By.cssSelector, and inside of quotes, taking the top-level tag name, div, hashtag, parent space a to specify the child node there. Next I'll show an example of using the nth-child. This is particularly helpful when there are a list of elements and we particularly want to find one element within the list. So take for example the…
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.