Example: Selecting the type of document in Baidu Wikipedia for example
Question one:Iterate through clicked radio boxes of all document types
# coding=utf-8 from selenium import webdriver from time import sleep driver = () driver.maximize_window() ("") driver.implicitly_wait(8) for i in driver.find_element_by_xpath("//*/input[@type='radio']"): # Iterate over all clicked radio implementations print(i) sleep(3) () sleep(3)
Question two:Click on one of the document types
# coding=utf-8 from selenium import webdriver from time import sleep driver = () driver.maximize_window() ("") driver.implicitly_wait(8) driver.find_element_by_xpath("//*[@id='t_ppt']").click() # Implement clickable PPT document types sleep(3)
Remaining question: Do you have a way to realize the indeterminate click to switch radio, you can leave the implementation method in the comments below, thanks!
Above this python + selenium click radio-radio implementation is all I share with you, I hope to give you a reference, and I hope you support me more.