java - WebDriver can't select from JQuery dropdown -


i have web form having jquery dropdowns. particular field holds date of birth. source field is:

<div class="tooltipgroup" style="z-index:19;">    <div class="day">       <div class="jqtransformselectwrapper" style="z-index: 19;">       <div>          <ul style="width: 100%; display: block; visibility: visible;">           <li class="optheading">           <li class="undefined">           <li class="undefined">           <li class="undefined">           <li class="undefined">           <li class="undefined">           <li class="undefined">              <a index="6" href="#">6</a>       </li>           <li class="undefined">              <a index="31" href="#">31</a>        </li> 

that's code trying of elements , put them in hashmap:

public void selectdob(int dob) {          webelement dobfielddropdown;          webelement content = driver.findelement(by.classname("leftclmn"));          driver.findelement(by.id("awrapper_dob_day")).click();          dobfielddropdown = content.findelements(by.classname("tooltipgroup")).get(2).findelement(by.classname("day")).findelement(by.tagname("ul"));          hashmap<string, webelement> dropdownvalues = new hashmap<string, webelement>();          (webelement el : dobfielddropdown.findelements(by.tagname("a"))) {             dropdownvalues.put(el.gettext(), el);              system.out.println(el.gettext());         }         dropdownvalues.get(dob).click();      } 

the code works fine 1 exception: can't values of fields, first visible when dropdown being opened.

1 2 3 4 5

the question how values of other fields?

i thank guys (especially hemche).

it turned out bug in latest firefoxdriver version 2.32. same code worked fine chromedriver , i've got of drropdown values. downgrading selenium version 2.31 solved problem , code works both drivers!

i'll register bug on selenium bug tracker!

that's final version of code:

public void selectfromdropdown(string option) {          webelement dobfielddropdown;          webelement content = driver.findelement(by.classname("leftclmn"));          driver.findelement(by.id("awrapper_dob_day")).click();          dobfielddropdown = content.findelements(by.classname("tooltipgroup")).get(2).findelement(by.classname("day")).findelement(by.tagname("ul"));          hashmap<string, webelement> dropdownvalues = new hashmap<string, webelement>();          (webelement el : dobfielddropdown.findelements(by.tagname("a"))) {             dropdownvalues.put(el.gettext(), el);              system.out.println(el.gettext().tostring());         }         dropdownvalues.get(option).click();      } 

cheers!


Comments

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -