Grabbing Logo Text From E-Commerce Website
On this page you'll learn how to grab logo text from a basic test e-commerce website.
Last updated
On this page you'll learn how to grab logo text from a basic test e-commerce website.
Last updated
Let's say we want to locate the logo element of this test e-commerce website (https://www.demoblaze.com/) and grab the "Product Store" text:
First, let's import Simple Selenium & initiate the webdriver with our desired startup options:
Visiting the target website is simple:
Now visit the target website on your normal web browser, right click the logo element, & click "inspect":
This should open the developer tools console. Get familiar with this, since you'll be using dev-tools a lot:
Looking at the <a> tag, we need to find a reliable attribute to consistently identify this product logo element. The class attribute looks promising, as it has a unique & human-readable value ("navbar-brand"), which is unlikely to change.
Now with Simple Selenium, you can use this class name ("navbar-brand") to locate the logo element:
And finally, let's grab the text inside this element:
This is the general procedure for reliably locating elements on any webpage. We'll cover more complex examples in the next pages.