Can anyone please provide me some knowledge regarding what is Class Name Locator in Selenium and how do i get started with it.
The Class Name locator aids in locating elements defined by the class attribute. Here’s an example of a LambdaTest login DOM screenshot where the login field is located through class name.
Here is the DOM structure:
<input type="email" name="email" value="" placeholder="Email" required="required" autofocus="autofocus" class="form-control mt-3 form-control-lg">
Below is the syntax of locating element through class name:
driver.findElement(By.className("form-control mt-3 form-control-lg "));