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>
asked Mar 2, 2016 at 10:33
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);
answered Mar 2, 2016 at 11:55
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

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.