Ask a Question

The combo box item is out of bounds error

SOLVED
karenriviam
Occasional Contributor

The combo box item is out of bounds error

Hi. I have a test that keeps failing on the dropdown menus. Firstly, it selects the wrong items from the dropdown and therefore the test fails. 

I added a delay just in case and still no good. I am new on this, I have been reading a few posts here on the same subject, but nothing seems to fit this scenario. Not sure what to do. If you give me instructions, please, explain with apples and pears because as I said, I am new here. Thanks in advance.

8 REPLIES 8
Marsha_R
Community Hero

Did you get this test by recording, and when you play it back it chooses a different entry than you did originally?


Marsha_R
[Community Hero]
____
[Community Heroes] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Heroes]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Hero] signature is used with permission by SmartBear Software.
https://community.smartbear.com/t5/custom/page/page-id/hall-of-fame
karenriviam
Occasional Contributor

Hi Marsha,

Yes, I recorded, I selected a DoB (Day, Month and Year let's say 14 July 2012) and school year (Year 5) and when running the test it selected only the first items from the drop-down menu (1 January 2021 and Reception) and at the year it will stop running and prompting the errors. I did put a delay, but by doing this it still will not select the DoB I wanted but selects a few items below, like 4 of February and on the year the test will stop running, I think because it does not select anything. 

What I would do is use Object Spy on the drop down and look for an index being used on the object values, so you can have something like MyDropDownMonth(0) that gives you January as a result. You may have to drill down in some of the levels using the three dots button at the far right of the ObjectSpy value.


Marsha_R
[Community Hero]
____
[Community Heroes] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Heroes]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Hero] signature is used with permission by SmartBear Software.
https://community.smartbear.com/t5/custom/page/page-id/hall-of-fame
karenriviam
Occasional Contributor

Hi Marsha, I tried that and still does not work. I wish I could show it to you, probably is something simple. My colleague is having the same issue as me...

I recorded a new test, more modular and the weird thing is that now passes the test!! BUT the information it submits is the wrong one! I used the Object Spy this time, so I cannot understand how now it passes the test although is selecting the wrong DoB?

Let's see a screenshot of the drop down and the object spy for the dropdown please.


Marsha_R
[Community Hero]
____
[Community Heroes] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Heroes]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Hero] signature is used with permission by SmartBear Software.
https://community.smartbear.com/t5/custom/page/page-id/hall-of-fame
karenriviam
Occasional Contributor

Screenshot of the test which passed but as seen, the expected image does not tally with the actual image:

 

image (20).png

 

Object Spy pointing Day:

 

image (19).png

 

Object Spy pointing at month:

 

image (21).png

Object spy pointing at year:

 

image (22).png

chriscc
Contributor

Hi @karenriviam.

 

I am not sure what language you use, but this is a generic function in Jscript/Java that will walk the  wItems of a list, looking for a match, then it should set the index. It assumes the object supports the properties wItemCount, wItem, wSelectedItem, so it doesn't do any error trapping.

 

Also, it could be expanded for other types of lists/objects that have different properties. A simple validation of which properties it supports is needed. (i.e., aqObject.IsSupported(object, property/method))

 

Additionally, I am not sure setting the index using  wSelectedItem will work so you might need to find a Method that sets/selects the item, look in the list of Methods.

 

The three additional functions are the calling functions for your specific controls.

 

I hope this helps.

 

function selectListItem(objElement, strValue)
{
  // walk all of the items and compare to the passed value
  for (var i = 0; i < objElement.wItemCount; i++)
  {
     if (aqString.Compare(objElement.wItem(i).wText, stringValue, false) == 0)
     {
     // use the found index to select the item from the list
     objElement.wSelectedItem = i; // if this doesn't work then look for a Method that might select or set the item
     break;
     }
  }
}

 

function setDOBDay(strValue)
{
  var dobDayElement = //your Code for selecting the DOB Element or the mapped object;
  selectListItem (dobDayElement, strValue);
}

function setDOBMonth(strValue)
{
  var dobMonthElement = //your Code for selecting the DOB Element or the mapped object;
  selectListItem (dobMonthElement, strValue);
}

function setDOBYear(strValue)
{
  var dobYearElement = //your Code for selecting the DOB Element or the mapped object;
  selectListItem (dobYearElement, strValue);
}

Chris
karenriviam
Occasional Contributor

Hi everybody,

 

In the end, I managed to find a solution. I select the Key method (instead of ClickItem) and write in the details the day, month and year. It worked! Unfortunately, I closed the window where I found this solution but it was in someone else's question.

 

Thanks for your time.

cancel
Showing results for 
Search instead for 
Did you mean: