From the course: Python Automation and Testing
Unlock the full course today
Join today to access over 24,700 courses taught by industry experts.
Solution
- [Instructor] Now that we have seen the challenge that we have taken up, let's take a step by step walkthrough of how to solve it. To start off, I'm going to open the code editor directly and let's jump right into the first step. As with all our code, I'm going to start off with importing the web driver from Selenium. So from Selenium import web driver. The next thing I'm going to do is create an instance of Firefox using the web driver with webdriver.firefox The first step is to navigate to the official Python website. So let's use driver.get to do that, and in here I type the URL that we want to navigate to, which is https www.python.org. And with this, we are already done with our first step. The second step is to locate an element by its id and print it out. To make the printing out easier, I'm going to create a variable element id and we are going to store the element that we find into this variable. So I use the driver dot find element by id method, and in here we are going to…
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)
-
-
-