0

How can I click on the login button ?

<a href="/bin/ids/login.smp.html?_=nc" rel="IDS_login">Login</a>

Below the code in the screenshot:

enter image description here

I can do it by xpath, but I wonder if there is other ways ?

Any help would be appreciated,

Thanks!

Berlin
  • 1,456
  • 1
  • 21
  • 43

1 Answers1

2

I can do it by xpath, but I wonder if there is other ways ?

I would suggest you, try using cssSelector which would be much faster than xpath to locate an element as :-

driver.find_element(:css, "div#anonymous > a[rel='IDS_login']").click

You can also locate this element using link_text as :-

driver.find_element(:link_text, "Login").click
Saurabh Gaur
  • 23,507
  • 10
  • 54
  • 73
  • 1
    Saurabh Gaur, nice thanks! can you please have a look on other ruby Selenium question :) `http://stackoverflow.com/questions/40076112/how-to-handle-firefox-chrome-login-pop-up-window-using-ruby-selenium-3-0-webdriv`, I'm pretty new at this.. – Berlin Oct 18 '16 at 02:07