Cycle through all the values from Dropdown box


I am new to EggPlant and trying to find out how to cycle through all the values from the dropdown box. Your help is much appreciated.


When working with an application the best thing to keep in mind is “How would a live user do it?”. So cycling through a drop down box would usually be done by using arrow keys or typing characters.

Arrow key behavior is pretty straightforward; you can just hit the arrow key until the item you want to have selected is selected.

Typing behavior is somewhat different based on the application or OS. The default Mac OS X behavior when typing is to try to find the closest complete match. So for a pop-up with US States typing “CO” will get you to “Colorado”. With Windows/IE typing a letter will take you to the first word with that letter, repeated hits of that letter will cycle through entries starting with that letter, so “CO” selects California first and then selects Orgeon, “CC” gets to Colorado (after California).

Hopefully that helps get you started but if you have specific questions about how to solve a particular situation just ask.

Thank you so much for your reply. For testing purposes, I will need to make sure user is able to add all products (e.g. 10 products) from the dropdown box to Shopping Cart. I understand that I can go through the capturing process with EggPlant for each product. It doesn’t seem to be the best approach. Any suggestions?


The main alternative to capturing images is to use a Text Image Generator to create images of the product names for you. Search for “text image generator” in the Help viewer to find the relevant documentation.

Using this approach you wouldn’t need to capture images for any of the product names, and your script might look something like this:

set productList to ("eggs", "milk", "bread", "cereal")

repeat with each productName in productList
    click "ProductDropDown" -- pop up the list
    click (text:productName, textStyle:"DropDown")
    -- do other processing here to validate that product
end repeat

Sorry that I didn’t get a chance to try the TIG approach you suggested until now, but got error "Click Error - Unable to get TextImage. No TextFont specified." when running the script. Do I need to know exactly what font type is being used for the Text in the dropdown list in order for EggPlant to recognize?


Yes. To generate an accurate image of the text, Eggplant needs to know the font, size, and color to use. Most often you’ll do this by defining a text style with these attributes for the particular type of control that you’re working with. I suggested “DropDown” as the textStyle name in the example code that I posted earlier, but that was just an example. You can define the text styles you need for your particular situation on the Text pane in the Preferences panel.