naeg
naeg

Reputation: 4002

interact with special combobox using selenium webdriver

I'm using selenium2 webdriver with firefox.

Usually, when there is a combobox for e.g. months I set a distinct month by send_keys(monthname).

I have a special listbox this time, where I can't simply send_keys() to it (not with webdriver nor manually). I'm not a web developer, so I have no idea what the actual difference is. This is the HTML Code of that combobox:

<div class="selectArea marke" style="width: 75px; ">
  <span class="left"></span>
  <span class="center">Month</span>
  <span class="selectButton"></span>
  <div class="disabled" style="display: none; "></div>
</div>

<select name="sregisterdmc" id="sregisterdmc" class="marke outtaHere" style="width:75px" multiple="">
  <option value="">Month</option>
  <option value="01">01</option>
  ...more options...
</select>

I have no idea how I could set an option here. I found out that I can get all the option values with .find_elements_by_tag_name(), but not how I actually set such one now. Thanks in advance!

Upvotes: 0

Views: 958

Answers (1)

prestomanifesto
prestomanifesto

Reputation: 12806

Do a click on the option element you want selected.

Upvotes: 1

Related Questions