Isoripper 0 Posted January 20, 2012 Report Share Posted January 20, 2012 Hi all, Im trying to figure out how to respond to a bad captcha inout on this page: http://www.tradedoubler.com/public/aRegisterAffiliate.action?language=de&country=DE Here is my code: type text(<name="code">, $solve captcha(<id="image_code">), "Standard") wait(1) if($contains($scrape attribute(<id="CODE_IMG_ID">, "src"), "error.png")) { then { loop(3) { wait for browser event("Everything Loaded", "") type text(<name="code">, $solve captcha(<id="image_code">), "Standard") focus(<name="code">) wait(2) } } } This page changes the image to either error.png or ok.png depending if you typed the right captcha. What I cant understand is why my code goes back to the loop when I type the correct captcha after a mistake? I think I have something out of place with my code that I need help with. Thanks! Quote Link to post Share on other sites
Isoripper 0 Posted January 20, 2012 Author Report Share Posted January 20, 2012 Nevermind, I figured it out (Correct me if Im wrong): if($contains($scrape attribute(<id="CODE_IMG_ID">, "src"), "error.png")) { then { loop while($contains($scrape attribute(<id="CODE_IMG_ID">, "src"), "error.png")) { wait for browser event("Everything Loaded", "") type text(<name="code">, $solve captcha(<id="image_code">), "Standard") focus(<name="code">) wait(1) } } } using loop while() seems to have solved the trick Quote Link to post Share on other sites
JohnB 255 Posted January 20, 2012 Report Share Posted January 20, 2012 Yeah, the only change I would make is the conditional...I would use loop while--->$exists(error.png) John Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.