I'm trying to figure out the answer to a problem I've recently discovered. I have some HTML as indicated below and what I want to do, is send an HTML snipped to selenium so it can click on the checkbox. However, I don't want to lookup by id because as you can see, the id is ugly. Instead, I am looking for an alternative method.
HTML:
<li class= "zone odd open night">...</li>
<li class= "zone even open night">...</li>
<li class= "zone odd open night">...</li>
<label for="srr-2-1397538000">Room 226 1:00 AM</label>
<input type="checkbox" name="srr-2-1397538000" id="srr-2-1397538000" value="Y" class="interactive">
<span class-"drag-handle">...</span>
</li>
<li class="zone even open night">...</li>
As you can see, I'm trying to lookup that specific checkbox to click but I don't want to do it by looking up via id. I would rather look up by "Room" or something more generic.
Does anyone have any suggestions as to how to do this? With using selenium, or some other webdriver?
Also, I've tried the classic:
element = driver.find_element_by_id("srr-2-1397538000")
element.click()
But as I said, this is not what I want.
Thank You