From the course: Python Automation and Testing
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
Locating elements by class
From the course: Python Automation and Testing
Locating elements by class
- [Instructor] Along with the methods that we've seen so far we can also locate elements using the class attribute. Let's take a look at this along with a code example. The HTML class attribute specifies one or more class names for an HTML element. These class names are used to point to a calls in a stylesheet. Typically a class is used to group a number of elements that have the same format or the same transition or have the same form, color, or anything in common. We use this method to locate elements when we know the class attribute of one or more elements. The first element with a matching attribute value will be returned. Let's take a look at the HTML code that we have been using so far. So here, we have a heading element with a class, content. So I'm going to copy this class name so that we can use it in our code. Let's head over to the desktop where I'll go to the Working Code folder, and I'll open the code that we have been working with so far here. Since we do not need…
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
-
-
-
-
(Locked)
What is the HTML DOM structure?1m 32s
-
(Locked)
Locating elements by ID5m 22s
-
Locating elements by name2m 8s
-
(Locked)
Locating elements by XPath6m 18s
-
(Locked)
Locating elements by class3m 6s
-
(Locked)
Challenge1m 20s
-
(Locked)
Solution6m 11s
-
(Locked)
Challenge1m 44s
-
(Locked)
Solution7m 44s
-
(Locked)
Challenge1m 26s
-
(Locked)
Solution5m 58s
-
(Locked)
-
-
-