2

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.

falsetru
  • 357,413
  • 63
  • 732
  • 636

1 Answers1

0

Try:

browser.find_by_xpath('//div[@data-name="pco"][@data-value="2"]').first.click()
Andersson
  • 51,635
  • 17
  • 77
  • 129