M
M
motya882020-02-12 12:00:11
Python
motya88, 2020-02-12 12:00:11

How to click on checkbox using selenium python?

Good afternoon. I ran into a problem when trying to auto-tick the checkbox using selenium.
Site https://service.nalog.ru/static/personal-data.html
I try to check this box 5e43be114158d418207519.png
but I get an error: selenium.common.exceptions.ElementNotInteractableException: Message: element not interactable

My code:

from selenium import webdriver


driver = webdriver.Chrome()
driver.get('https://service.nalog.ru/static/personal-data.html')
driver.find_element_by_id('personalData').click()


Can you tell me how to put a check in this checkbox?
Thank you.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
C
coderisimo, 2020-02-12
@motya88

You may need to click on the parent. For example, if the checkbox is in a div, try clicking on the div.
Or in your case click on #unichk_0

V
Vladimir Kuts, 2020-02-12
@fox_12

Alternatively, click using javascript:

driver.execute_script("document.getElementById('personalData').checked = true")

C
che_aa, 2020-02-12
@che_aa

click = driver.find_element_by_class_name('checkbox checkbox-off')
click.click()

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question