Locating web elements

In this section, we will perform a search on http://automationpractice.com to obtain a list of products that match the search query, illustrating the use of selenium.webdriver. Web elements are elements that are listed in a web page or that are found in a page source. We also look at a class called WebElement, used as selenium.webdriver.remote.webelement.WebElement.

The automation practice website (http://automationpractice.com/) is a sample e-commerce website from http://www.seleniumframework.com that you can use for practice.

To begin with, let's import webdriver from selenium, set a path to chromedriver.exe, create an object of webdriver—that is, driver, as implemented in the previous section, Accessing browser properties ...

Get Hands-On Web Scraping with Python now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.