N
N
nik_ses2022-01-19 18:18:11
Python
nik_ses, 2022-01-19 18:18:11

How to mark Selenium+Python CheckBox?

Good day!
I am writing autotests, or rather I am just learning, I ran into a problem - I can’t click on the CheckBox accessing an element not by FULL XPATH
61e8f03d45b57645276281.png
When accessing by ID - driver.find_element(By.ID, 'userregisterwelcomeform-agree_contract').click()
by name - driver .find_element(By.__name__, "UserRegisterWelcomeForm[agree_personal_data]").click()
on css - driver.find_element(By.CSS_SELECTOR("label[for='userregisterwelcomeform-agree_contract']")).click()
element not found
FULL XPATH only - driver.find_element(By.XPATH, '/html/body/div/div[1]/div[2]/div/div[2]/div/form/div[4]/div[1 ]/div/label/span[1]').click()
can be ticked...
But the task is that, ideally, the call should be by ID, but not in any case (find_element(By.XPATH, '/html/body/div/div[1]/div[2]/div/div[2 ]/div/form/div[4]/div[1]/div/label/span[1]').click())
Please help the experts!
Thanks in advance!

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question