1

I literally new with web scraping and selenium.

I was trying to click the label button, so, if the label clicked, the color will be change, like the picture below.

enter image description here

I think, it can be done by accessing the input 'id', but it won't work, I was trying to click the id button using this syntax

button = driver.find_element_by_id('r0_1')
button.click()

But the error I got is something like this

selenium.common.exceptions.ElementNotInteractableException: Message: element not interactable

So, I think I should click the label to get access into the 'for' element. Is anyone know how to click the label with the 'for' element because that one is an unique value also?

Any help would be appreciated, thanks!

*Note: This code is rebuilt from the original link in case to make it easier to read

Here is the link for the source code: link

1
  • 1
    no sir, you don't have to ask me, you deserve it. Thank you!!! if may, please also vote up this question, perhaps another can be helped to from you Commented Jul 21, 2021 at 7:01

1 Answer 1

2

Can you try this way

By label

element = WebDriverWait(driver,2).until(EC.element_to_be_clickable((By.XPATH, "//label[@for='r0_3']")))  

element.click()

The below will click based on the input

element = driver.find_element_by_xpath("//*[@id='r0_3']")
driver.execute_script("arguments[0].click();",element)
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.