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

Solution

(upbeat music) - [Instructor] Now that we have seen the challenge that we have taken up, let's take a step by step walk through 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 webdriver from selenium. So from selenium import webdriver and the next thing I'm going to do is create an instance of Firefox using this webdriver with webdriver.Firefox. Now, the first step is to navigate to the selenium official website. So let's use driver.get to do that. And in here, I'm going to get the URL, which is https://selenium.dev. And with this, we are already done with our first step. The second step is to locate an element by its ID and then print it out. To make the printing out easier. I'm going to create a variable element_id and store the element that we find into this variable. So I'm going to use driver.find_element_by_id method and in here, I'm going to…

Contents