Search until 1 of the items is found on screen

Hello, I’m learning more eggplant for my training and I’m doing some experimenting. After searching the documents online I’m having issues solving my problem. I’m trying to write code that will identify at least 1 of the items in a container.

Example: I have a website that will display “good morning” or “good afternoon” on the homepage depending on the time of day. In this example, I’m trying to identify if the user is on the home page by searching for 1 of the text items in the container, either “Morning” or “Afternoon”

my code thus far:
put [“morning”, “afternoon”] into Time_of_day

Repeat until ImageFound(text: Time_of_Day) or Counter > 5
add 1 to counter
wait .5
End repeat

Running the code i can see the container is made with the correct items, but i am unsure how to loop through each item separately to see if either of those items are on screen.

This is what I would use:
put [“morning”,“afternoon”] into Time_of_day
Repeat with each item of Time_of_day
If ImageFound(text:IT,waitFor:5) then Exit Repeat
End Repeat

Hope this helps.

It’s not always well known, but commands and functions in Eggplant that search for images or text can be called with multiple images or text property lists, which will search for all of them (similar to the way an image collection will search for all of the images).

So you can easily do this with a single call:
if imageFound({text:"morning"},{text:"afternoon"}) then ...