I am new on selenium and in this case I'm trying build code with selenium python to click checkbox from this HTML:
<div class="checkBox" xpath="1"><input type="checkbox" name="registerPrivacyAgreement" id="registerPrivacyAgreement" value="1"><label for="registerPrivacyAgreement" lang="lang_9" class="privacyAgreement">I acknowledge that my data will be processed in accordance with the <a target="_blank" href="PrivacyPolicy.html">Privacy Policy.</a> & <a target="_blank" href="UserAgreement.html">User Agreement.</a></label></div>
Snapshot of the checkbox:
I already try to click that checkbox from xpath with this code:
driver.find_element(By.XPATH,"/html/body/div[4]/div[1]/div[12]/div/div[4]/input").click()
I also tried by ID
, & CSS_Selector
but when I run, its doesn't click the checkbox but open newpage about UserAgreement I already try with other way but it always open newpage about UserAgreement not click the checkbox. Then I try with selenium IDE and record after that I play and then its work, but when I copy code from selnium IDE it show like this:
xpath=//div[@id='container']/div/div[12]/div/div[4]/label
Then i try back to my python code and it still open newpage about UserAgreement not click that checkbox. can someone explain me what happen and how to solve that?
Element Snapshot:
Aucun commentaire:
Enregistrer un commentaire