sazuka 0 Posted February 5, 2016 Report Share Posted February 5, 2016 (edited) Is there a solution to combine.. incase a website doesnt load properly or is offline... Combing: wait for element and if else example: navigate to www.login.comWait for Element (innertext Login to shop up)If innertext login not showing upthen navigate to www.login.comelseclick login Edited February 5, 2016 by sazuka Quote Link to post Share on other sites
deliter 203 Posted February 5, 2016 Report Share Posted February 5, 2016 yes the function you need is this http://wiki.ubotstudio.com/wiki/Exists here is some example code reset browser load html("<div id=\"container\"> <p id=\"myId\"></p> </div> <script> console.log(parseInt(Math.random() * 10)) function fillText()\{ randNum= parseInt(Math.random() * 10) document.getElementById(\"myId\").textContent = randNum if( randNum === 0)\{ document.getElementById(\"container\").innerHTML = document.getElementById(\"container\").innerHTML + \"<br><p id = \'nowExists\'>should now stop waiting</p>\" \} else\{ setTimeout(function()\{ fillText() \},2000) \} \} fillText() </script>") comment("waiting for 0 to appear,if does not within 15 seconds,go with plan b") wait for element(<id="nowExists">,15,"Appear") if($comparison($exists(<id="nowExists">),"=",$true)) { then { alert("exists") } else { alert("do something else") } } 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.