0
<paper-radio-button name="NOT_MADE_FOR_KIDS" class="style-scope ytcp-audience-picker iron-selected" role="radio" tabindex="0" toggles="" aria-checked="true" aria-disabled="false" aria-selected="true" checked="" active=""> <div id="radioContainer" class="style-scope paper-radio-button"> <div id="offRadio" class="style-scope paper-radio-button"></div> <div id="onRadio" class="style-scope paper-radio-button"></div> <paper-ripple id="ink" center="" class="circle style-scope paper-radio-button" checked=""> 

I am trying to select the 'No, it's not made for kids' option when uploading a video to youtube, I do

kids_box = driver.find_element_by_name('NOT_MADE_FOR_KIDS') kids_box.click() 

Also tried with class name and id, I tried clicking the id='onRadio' too. Any help on this is appreciated!

0

    1 Answer 1

    1

    You are just clicking to the button as a whole and I think it is wrong.

    Instead, you should be clicking to the desired option on the radio button. In order to do this, please try the code snippet below.

    kids_box = driver.find_element_by_id('onRadio') kids_box.click() 

    If the above solution does not work, what you should be doing is, right click to the option circles in the radio button, then click inspect in Google Chrome, then right click to the button again and then click inspect again.

    After completing this progress, you will see the corresponding line of the radio button. Right click to it, select copy, then select copy xpath and use the function below:

    kids_box = driver.get_element_by_xpath("//div[@id='a']/div/a[@class='click']") kids_box.click() 

    You should paste the xpath to inside the parantheses.

    1
    • thanks for your answer. I just found that this works for me: kids_section = browser.driver.find_element_by_name("NOT_MADE_FOR_KIDS") no_label = kids_section.find_element_by_id("radioLabel") no_label.click()
      – user11910733
      CommentedApr 17, 2020 at 11:56