# Search until 1 of the items is found on screen

**URL:** <https://forums.eggplantsoftware.com/t/search-until-1-of-the-items-is-found-on-screen/7501>\
**Category:** Eggplant Functional\
**Created:** [March 2, 2021, 4:03pm UTC](https://forums.eggplantsoftware.com/t/search-until-1-of-the-items-is-found-on-screen/7501 "2021-03-02T16:03:08Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Darius169](https://forums.eggplantsoftware.com/letter_avatar_proxy/v4/letter/d/c6cbf5/32.png) [@Darius169](https://forums.eggplantsoftware.com/u/Darius169)\
**Post date:** [March 2, 2021, 4:03pm UTC](https://forums.eggplantsoftware.com/t/search-until-1-of-the-items-is-found-on-screen/7501/1 "2021-03-02T16:03:08Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![DaveHester](https://forums.eggplantsoftware.com/user_avatar/forums.eggplantsoftware.com/davehester/32/104_2.png) [@DaveHester](https://forums.eggplantsoftware.com/u/DaveHester)\
**Post date:** [March 5, 2021, 2:51pm UTC](https://forums.eggplantsoftware.com/t/search-until-1-of-the-items-is-found-on-screen/7501/2 "2021-03-05T14:51:52Z")

</div>

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.  
Dave

---

<div class="post-metadata">

**Author:** ![SenseTalkDoug](https://forums.eggplantsoftware.com/user_avatar/forums.eggplantsoftware.com/sensetalkdoug/32/88_2.png) [@SenseTalkDoug](https://forums.eggplantsoftware.com/u/SenseTalkDoug)\
**Post date:** [March 13, 2021, 10:10pm UTC](https://forums.eggplantsoftware.com/t/search-until-1-of-the-items-is-found-on-screen/7501/3 "2021-03-13T22:10:35Z")

</div>

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 ...`
