Forum Discussion
Okay, can you check whether the list item have spaces at begin or ending? or list item string you pass spelled correctly?
May be you can rewrite the method something like this...
function selectDropdownItem(ddlItem, mnuItem) { // jScript var isItemClicked = false; ddlItem.Click(); // click the dropdown aqUtils.Delay(500); var listItems = ddlItem.FindAllChildren("ObjectType", "ListItem", 1, true).toArray(); if (listItems.length > 0) { for (var i = 0; i < listItems.length; i++) { if (aqString.Trim(listItems[i].Caption).toLowerCase() == mnuItem.toLowerCase()) { listItems[i].Click(); isItemClicked = true; break; } } } if (!isItemClicked) { // throw exception like menuitem not available } }
The lastest function I've added finds all the properties for each listitem but it still won't click the actual item.
The screen shots are the errors and the items found using the debug mode.
Thanks
- SaravanaKumar_N6 years agoContributor
Then we have to create our own scroll method.
This might work for you, give it a try. Pass the objects - dropdown and listItem to be selected to this method. You may also have to name map your vScroll bar accordigly else update the code as per your need.
function scrollIntoView(dropdown, listItem) { while ( (dropdown.Height < (listItem.Top + listItem.Height)) && ((dropdown.vScroll.Pos + 5) < dropdown.vScroll.Max)) { dropdown.vScroll.Pos += 5; Delay(100); } while (listItem.Top < 0 && (dropdown.vScroll.Pos - 5) > 0) { dropdown.vScroll.Pos -= 5; Delay(100); } }
- tristaanogre6 years agoEsteemed Contributor
What it looks like is that, after you click on the control, the list items are not necssarily visible on screen. Before you click on them, try calling "scrollIntoView" on the object (I'm assuming this is a web application). That will make sure that it is visible on screen before any attempts to act on it are executed.
- russelld6 years agoContributor
No, "scrollIntoView" is not available. Its a desktop application not a web application.
- SaravanaKumar_N6 years agoContributor
So now you are able to find the item. And did you get a chance try this way..
Can you check ListItem object has any methods like 'Focus' ? (you can check in the object browser)
If available, you can do..
listItems[i].Focus();
Delay(500); // delay may be needed, if not remove it
listItems[i].Click();
- russelld6 years agoContributor
Thanks
Focus is availble with the parent two levels up. The attached is the properties I got to work with
Related Content
- 12 months agolokwk216
- 11 years agoRavik
- 6 years agofunmay
- 12 years agositasrikanth
Recent Discussions
- 2 hours agosimonaferrara
- 6 hours agoAli2