Reputation: 479
Need help with Xpath or CSSSelector locator for below HTML Code for a checkbox element. Checkbox element is present on the webpage with below URL : https://www.seleniumeasy.com/test/basic-checkbox-demo.html
<div class="checkbox">
<label>
<input type="checkbox" class="cb1-element" value="">Option 1</label>
</div>
Upvotes: 0
Views: 44
Reputation: 37
I'm using Python, so in my case would look like this if I would use XPath:
driver.find_element_by_xpath("//label[contains(.,'Option 1')]").click()
You can do like this if your page contains only one Option 1
text
Upvotes: 0