Wednesday, 11 September 2013

How to click on a button webelement using css_selector with Selenium webdriver for identical button types

How to click on a button webelement using css_selector with Selenium
webdriver for identical button types

For a HTML,
<div class="some-class">
<button type="button">Ok</button>
<button type="button">Cancel</button>
Both button type are the same for two different buttons so how can I click
on the Ok button using find_element_by_css_selector? I tried
driver.find_element_by_css_selector("div.some-class >
button.button[1]").click() but it didn't work for me.

No comments:

Post a Comment