0

how to select login button using selenium web driver

<li id="buttons" class="greetings_fmt">
    <a href="#">
       <div class="user_btn log_in_icon">LOG IN</div>
    </a>
    <a href="#">
       <div class="user_btn sign_up_icon">SIGN UP</div>
    </a>
</li>

tried with this code but not working

WebElement ele = driver.findElement(By.id("buttons"));
      List<WebElement> ele1 = ele.findElements(By.tagName("a"));
      for(WebElement e : ele1){         
         e.click()

      }
1
  • driver.findElement(By.xpath("//*[contains(text(),'LOG IN')]")).click(); Commented Jun 8, 2017 at 6:32

2 Answers 2

1

It looks what you are trying to automate is incomplete.Login is not a button. It is a link. Clicking on this link will take you nowhere as href="#".

Sign up to request clarification or add additional context in comments.

1 Comment

when i tried am getting 'unknown error: Element <a href="#">...</a> is not clickable at point '
0

You can use following xpath for user case:

Xpath=//*[contains(text(),'LOG IN')]

Hope it will work for you.

Comments

Your Answer

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.