Selenium => 4BUTTON with same href , same class , same text wanna click on 4

3610 views selenium
3

I just tried to find element on website but can't find it .Code is :

<a href="#" class="btn btn-default free_send_button">Basla</a>      

Could you help me about it . There is a 4 same html button codes : 4 same href , 4 same class , 4 same text code... I just wanna click on 4. I tried some codes i wrote'em below . Can you fix my codes if its possible and usefull or which way to find element is best way to do it ? Thanks already..

self.web.find_element_by_xpath("(//href[text()[contains(.,'#')]])[1]").click()

answered question

1 Answer

11

I just tried to go on class'name and found it .I hope it might be helpful:

self.web.find_element_by_xpath("(//a[contains(@class,'btn btn-default free_send_button')])[1]").click()

posted this

Have an answer?

JD

Please login first before posting an answer.