lundi 5 avril 2021

How to click on checkbox with selenium in python

I'm trying to choose a checkbox from a certain website. this is a part of their HTML code.

<div class="deliveryCheckboxContainer">
                                                        
<input class="deliveryCheckbox hiddenCheckbox" id="deliveryCheckbox-684" data-deliveryid="684" type="checkbox" /><label for="deliveryCheckbox-684" class=" checkbox classic"></label>
        
</div>

I tried a few different approaches. I either get an error saying the element isn't there or that it cannot be interacted with.

This is an example of what I tried:

browser.find_element_by_xpath('//*[@id="deliveryCheckbox-684"]').click()



Aucun commentaire:

Enregistrer un commentaire