From the course: Selenium Essential Training
Unlock the full course today
Join today to access over 24,000 courses taught by industry experts.
Combine multiple CSS attributes - Selenium Tutorial
From the course: Selenium Essential Training
Combine multiple CSS attributes
- [Instructor] Using multiple CSS selectors can be necessary when a web page has many of the same type of elements, and the CSS selector needs to describe a unique element, and there are no other good options. There are many different combinations of CSS selectors that can be used to locate elements. In this video I'll discuss the following: tag and class or tag and ID, tag and attribute, class and class. But besides the few I cover, there are so many more. Let's talk about using tag and class together. Say I have a simple text field where the html is defined as input class is equal to q, type is equal to text. As shown in the last video, I could simply use class name, but say the class name is used somewhere else and I want be a little bit more specific and use the tag name as well to define this CSS selector. So I can use a combination of the two and I can say driver dot find element by CSS selector and in quotes I can say input, using the tag name dot q to also describe the class…
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.