How To Click On A Button Webelement Using Css_selector With Selenium Webdriver For Identical Button Types
For a HTML,
Both button type are the same f
Solution 1:
Use div.some-class > button.button
as selector becasue find_element_by_css_selector
return the first matched WebElement:
driver.find_element_by_css_selector("div.some-class > button").click()
If you want be explicit use :nth-child(1)
or :first-child
.
UPDATE
selector was wrong. Selector should be div.some-class > button[type=button]
or simply div.some-class > button
.
Post a Comment for "How To Click On A Button Webelement Using Css_selector With Selenium Webdriver For Identical Button Types"