How to locate identifiers in Selenium
for the following line of code?
<a href="loginPage" class="loginBtn" data-toggle="modal" data-target="rnr-loginPanel">Login</a>
I have tried:
driver.findElement(By.xpath("//a [contains ( @href = 'loginPage' )]")).click();
but it is not working for me.
There is a syntax problem with the contains keyword in your xpath. Following should work -
Also, a better and easier way would be