stanf 43 Posted October 2, 2012 Report Share Posted October 2, 2012 I was scraping a site , every thing was going fine when the site had a hiccup and left me with nothing to scrape. how is this handled by you pros?I know now that i have to put in a a test to make sure that the target of the scrape is actually there?But if it isn't how do I make the loop start over?ordo I put in a javascript to reload the page and hope that it reloads the proper page? Quote Link to post Share on other sites
k1lv9h 76 Posted October 3, 2012 Report Share Posted October 3, 2012 Hi, Sample code:set(#checkedpagedata, "false", "Global") set(#checkedpagedatacount, 0, "Global") loop while($comparison(#checkedpagedata, "=", "false")) { if($exists(<innertext="5 star">)) { then { set(#checkedpagedata, "true", "Global") } else { if($comparison(#checkedpagedatacount, ">=", 9)) { then { run javascript("window.location.reload()") wait for element(<innertext="5 star">, 30, "Appear") set(#checkedpagedatacount, 0, "Global") } else { } } wait(1) increment(#checkedpagedatacount) } } } Change these lines to a element on the webpage you are about to scrape. It will not get out of the loop until the element appears on the webpage.if($exists(<innertext="5 star">)) {wait for element(<innertext="5 star">, 30, "Appear") sample-page-check-reload-001.ubot Kevin 1 Quote Link to post Share on other sites
stanf 43 Posted October 3, 2012 Author Report Share Posted October 3, 2012 thanks that what i thought check, check for a common element and if it is not there reload the page, thanx again 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.