简体   繁体   中英

How do I control radio button in splinter Python?

i have two options to press the button, i want the second option (which data-value is 2. the code of the page is :

<div class="a-C a-C-bg" data-name="pco" data-value="1" role="radio" aria-checked="false" style="-webkit-user-select: none;"><span class="a-C-Qa"></span><div class="a-C-Q">הודעת טקסט (SMS)</div></div>

<div class="a-C a-C-bg a-C-q" data-name="pco" data-value="2" aria-checked="true" style="-webkit-user-select: none;" tabindex="0"><span class="a-C-Qa"></span><div class="a-C-Q">שיחת טלפון אוטומטית</div></div>

i have tried:

one= browser.find_by_name('pco')
two=browser.find_by_tag('pco')
three= browser.find_by_value('pco')
four= browser.find_by_css('-webkit-user-select:none;')

print one
print two
print three
print four

but it all prints null (so i cant control the radio button). also tried:

browser.choose('pco', '2')

but doesnt work.

尝试:

browser.find_by_xpath('//div[@data-name="pco"][@data-value="2"]').first.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