Discussion
Pegasystems Inc.
US
Last activity: 6 Nov 2018 20:02 EST
Pega Robotics - Select Item By Index trick
For web adapters, the combobox is called a Select. Normally, you would choose SelectItemByText to find and select an item in the list. Sometimes, though this takes a very long time due to the Select having a large number of items. A client I was working with recently had over 9000 items in the list and selecting by text was taking a long time. To speed up the process we took another approach that worked well. This involved using a script to parse the list from the InnerHtml and return the index of the item we were looking for. Then we could do a SelectItemByIndex which is very fast. Here is the automation and the script - you may need to modify the script for your needs but this should get you started.
**Moderation Team has archived post**
This post has been archived for educational purposes. Contents and links will no longer be updated. If you have the same/similar question, please write a new post.
-
Reply
-
Share this page Facebook Twitter LinkedIn Email Copying... Copied!
Pegasystems Inc.
US
Thanks Jeff for sharing this for our Robotics users in the PSC! :)
TCS
IN
Thank you Jeff. It is really helpful.
IBM
CN
Awesome,It is helpful.
Scotiabank
CA
Thanks Jeff for sharing this. Its not only explaining string comparison but also how .net code can be used in methods.
Escobar Rueda
Hi, Jeff.
Thanks Jeff for this post, but what about a combobox which doesn't have the "SelectItemByIndex"? How can I select a specific ítem? How "SelectItem" with wildcards Works?
Pegasystems Inc.
US
Small edit to script to support option values that are html encoded.
Bank of America
IN
How to select multiple items? Please help.
Pegasystems Inc.
US
If the dropdown allows you to select multiple items, you just need to run the FindOptionIndex to retrieve each index and then perform a SelectItemByIndex for each one.
Bank of America
IN
Thanks Jeff for reply, In my automation I need to select two items (Ctrl + Select two items mouse right click from list) and then click on search button, but using selectitembytext I am able to select only one. please help.
Pegasystems Inc.
US
You will need to determine how the selections are registered with the page. If that is accomplished by setting each option with the "selected" attribute you could modify the innerhtml. That may be different for each implementation, however.
Remember, this tip is for selecting items from a long list. For a short list, SelectItemByText will work fine.
Cognizant
AU
Hi Jeff, I have a scenario where I have to select multiple options from the select control, manually it is done by holding the ctrl key, but through studio I didn't find any solution. Could you please help me out.
Pegasystems Inc.
US
Look at my comment above about modifying the inner html.