In the past few years, interest in visual foraging, where participants search for multiple targets at a time, has increased, as such tasks may provide a richer picture of visual attention than traditional single-target visual search tasks. Little is known about visual foraging in childhood, so we tested 67 6th grade Icelandic children (mean age = 11.80 years, SD = 0.30 years; 36 girls) on a foraging task involving multiple targets of different types, also measuring three subdomains of executive functioning: inhibition, attentional flexibility, and working memory. The foraging results were then compared to findings from a previous study on younger children (66 children aged 4-7 years). The results show that foraging ability improves dramatically between the preschool and middle school years, and that this improvement reflects greater ease with switching between target types. The older children showed foraging patterns previously seen for adults: randomly switching between target templates during feature foraging, but exhaustively foraging for a single target type before switching during conjunction foraging. Younger children, conversely, tended to stick with the same target type for long runs during feature foraging. Switch costs were also much lower for the older children, resulting in faster and more efficient foraging. Lastly, a connection was established between foraging ability and both working memory and attentional flexibility, but not inhibition. Our study shows that foraging is a promising field of study to further our knowledge of visual attention, how it changes throughout the lifespan, and how it is connected to other cognitive functions.