0

I am using given below xpath but my script is not clicking on these element
Login_Btn = "(//a[contains(text(),'Login')])[2]";

OR

"//div[@id='bd_login']/a" ;

driver.findElement(By.xpath(Login_Btn)).click();

FED code :

<div class="row emailExist">
<div class="rowL">
<div class="rowR">
<div class="cover">
<i id="bd_email_err" class="erLbl"/>
<div id="bd_login" class="dspN" style="margin-top:5px">
An account already exists for this email. Please use a different email or 
<a ").click();"="" #login_layer="" onclick="$(" href="javascript:;">Login</a>
</div>
</div>
</div>
1
  • please share html so we can help Commented Mar 2, 2016 at 10:41

1 Answer 1

2

Try this

WebElement element = driver.findElement(By.xpath(Login_Btn));
JavascriptExecutor executor = (JavascriptExecutor)driver;
executor.executeScript("arguments[0].click();", element);
1
  • 2
    you should add description for your answer, so that user can understand the meaning of code. Commented Mar 2, 2016 at 12:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.