Miquel Torres Miquel Torres - 1 year ago 111
Python Question

Click on second button (identical buttons) Selenium python

I have 2 buttons with the same value and class, they are identical.

<input class="button" value="Ir" type="submit">

I want to click the second one, that it is in
<div class="smallfont">

How can i do that with python Selenium? Thanks ;D


Answer Source

You can grab references to both elements and just click the second one.

buttons = driver.find_elements_by_css_selector("input.button");
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download