Select item from drop down list


I have a drop down list with a default value displayed. In one handler i have code as follows

if imagefound ("Text: “Default” ,TextSize: “11”) then
Click ("Text: “Default” ,TextSize: “11”)
Click ("Text: “mytext”,TextSize:“11”)
end if

This code works fine, i.e clicks the default text on the dropdown list to display the rest of the items in the dropdown and then clicks myText tem from this dropdown.

This same code works fine in one handler but when used in another handler to select same items, it gets stuck after first Click.

It does not execute the second click at all.

Any ideas why it behaves so?


I suspect it’s a timing issue.

I would try:

  1. Slow down the remote work interval:
put the remoteWorkInterval into current
set the remoteWorkInterval to 1

What this does is slow down eggplant a little bit in that handler. If the script works, then you know it’s a timing issue and you can try to either keep the above, and then reset the remote work interval (that’s why I suggest storing it in a container) after it’s finished or see if there’s something slowing eggplant down (ie multiple user accounts open on your mac, safari, CPUWaster,iTunes all at the same time) or the SUT down.

  1. If that doesn’t work, record a movie (Eggplant will do that for you–see the control menu) and play it back in slow motion and see what’s actually happening and tweak the script from there.

Hope this helps

Good tip on the movie, but consider that the script results screen shots can also provide a valued clue as it shows you exactly what is going on at the moment of failure.

When my camera control script quit at 3am 75 hours(!) into it’s run, the screen grab showed me that the “infamous” windows update had initiated a machine shutdown, capturing a movie on a 75 hour run script would be a bit too large to swallow. needless to say it’s on my checklist of things now, like avoiding putting windows anwhere near the tooltrays where those popups can ruin image recognition (not quite there on catch/throw to get around those).