Dropdown selection in IE 11 doesnot work

Ask general questions here.
Posts: 21
Joined: Wed Jun 18, 2014 10:17 am

Re: Dropdown selection in IE 11 doesnot work

Post by lila » Fri Mar 17, 2017 10:50 am

I had a discussion with our developers here and it seems that they are passing empty string in first value of the list item. I am receiving the value as null for the first element and hence it is throwing a null pointer exception for me. I need to find a solution for it now. Thank you all for your valuable inputs

User avatar
Ranorex Guru
Ranorex Guru
Posts: 6553
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: Dropdown selection in IE 11 doesnot work

Post by odklizec » Fri Mar 17, 2017 12:48 pm


I'm somewhat lost ;) When exactly it fail? Only if you pass the element "locationone"? Is there an element with such "Text" attribute in the list? If there is no such element, then of course, it must fail (not only in IE11, but IE9 too). If you want to select first (empty) item in the list, then you must most probably pass empty string to your method?
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration

Posts: 21
Joined: Wed Jun 18, 2014 10:17 am

Re: Dropdown selection in IE 11 doesnot work

Post by lila » Wed Mar 22, 2017 2:10 pm


Let me explain in detail about this issue. My script fails whenever a dropdown contains a null value as the first option. Example of the dropdown is mentioned below;
Dropdown.png (3.36 KiB) Viewed 1056 times
Here if you have noted the first listitem in the dropdown is null.

I am building my xpath as mentioned below;

ListItem item = "/container[@caption='selectbox']/listitem[@text='" + comboItem + "']";

So during the loop execution when a null value is assigned to the ListItem, it cannot handle null values and hence error occurs in that line and it comes out of loop and ends up selecting none of the dropdown. Also as mentioned before, our developers who built this website have purposefully made sure that TagValue for the null value dropdown is also null. Hence this error is triggered. Hope now I have explained clearly.

Posts: 254
Joined: Tue Mar 24, 2015 5:05 pm
Location: Des Moines, Iowa, USA

Re: Dropdown selection in IE 11 doesnot work

Post by Vaughan.Douglas » Wed Mar 22, 2017 4:18 pm

You might want to take a look at the select method on the Option object.

Since the option objects don't exist until the select box is clicked, you'll need to click on it. Once it's open then use your same RxPath, but rather than listitem use option.

"//option[@text='" + comboItem + "']";

I don't want to go through all of the permutations available for getting an object, but you're going to get that object and perform a .Select on it directly.

I've used this many many many many times on a particular Oracle application that does the same thing with its select boxes. In some instances the select box object isn't even the parent (or ancestor) of the option objects themselves. In those cases I just look for my option tag as a descendant of the base DOM. This can take Ranorex a little longer to find it, so you may need to try a couple of different approaches.

Let me know if you run into troubles implementing a solution.
Doug Vaughan