I have copied the following piece of HTML from https://en.wikipedia.org/wiki/Carnegie_Mellon_University
<img class="mw-logo-tagline" alt="The Free Encyclopedia" src="/static/images/mobile/copyright/wikipedia-tagline-en.svg" width="117" height="13" style="width: 7.3125em; height: 0.8125em;">
The class=”mw-logo-tagline” indicates a text near the logo of Wikipedia .
If we click on the text then it will redirect us to the Home page.
Here we will automate this process by class name locator.
First open the url using the get() method as below.
driver.get(“https://en.wikipedia.org/wiki/Carnegie_Mellon_University”);
The syntax to find the element using Class Name locator using selenium java is given below.
driver.findElement(By.className(“mw-logo-tagline”)).click();
To know how does this driver object come, you have to check the post on –Different web drivers invoking using selenium java