As soon as you see her head in their direction or even look at them for that matter, that's when you need to correct her by giving a quick tug on her leash and saying "leave it" in a low, firm voice then redirect her attention elsewhere before she has the opportunity to make any contact with them. You have to be more interesting than anything else. It may take a while because she is trying to herd them but be persistent and continue with the basic obedience at EVERY opportunity you have.