The radio button operation Selenium

Single-box operation:

        What is a single box? It was only ever meant to select an option. Radio button icons are generally circular. We can be positioned by selenium directly to the selected option, and then click with the click method to achieve.

Code section rb.html attached below:

Simple achieved by selenium location:

import time

from selenium import webdriver

# Designated driver

driver = webdriver.Chrome(r'C:\webdriver\chromedriver.exe')

# Open URL

driver.get('file:///C:/Users\Administrator/PycharmProjects/1120/web_driver/lesson3/rb.html')

# Used here to find the property value

driver.find_element_by_css_selector('input[value=male]').click()

time.sleep()

driver.quit()

 

Guess you like

Origin www.cnblogs.com/peipei-Study/p/11883290.html