简体   繁体   中英

Python Selenium Select Input

Hello I am coding selenium bot. I have a problem. How can I select male gender in radio input in these code

<label class="gl-radio-input__option"><input type="radio" class="gl-radio-input__input" value="Male"><span class="gl-radio-input__label">Erkek</span></label>
<input type="radio" class="gl-radio-input__input" value="Male">
driver.find_element_by_css_selector("input.gl-radio-input__input[value='Male']").click()

I solved it with xpath.

You can copy of the span's xpath and click

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM