Berlin Berlin - 1 month ago 11
Ruby Question

Ruby Selenium 3.0 - how to click on 'rel Attribute'?

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!

Answer

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
Comments