Urgent Enquirer 0 Posted September 4, 2021 Report Share Posted September 4, 2021 Hi, Ubot 5 fails to click. Test and see. Definitely following code fails to click Google's Search button on google homepage. Code:3:1592629Ubot fails to run this IF/ELSE condition. [code] if($exists($element offset(<tagname="svg">,1))) { then { click($element offset(<tagname="svg">,1),"Left Click","No") } else { alert("ERROR ALERT: Cannot detect \"Search Button\"! Quitting the session.") } } [/code] Context Code: [code] ui text box("Keywords",#ui textbox_keywords) ui drop down("Max Results","10,20,30,40,50,60,70,80,90,100",#ui dropdown_max results) ui save file("Save To",#ui save file_save to) ui stat monitor("Total Results",$list total(%urls)) divider divider set(#max results,#ui dropdown_max results,"Global") set(#keywords,#ui textbox_keywords,"Global") set(#save to,#ui save file_save to,"Global") divider navigate("https://www.google.com","Wait") wait for element(<name="q">,"","Appear") wait($rand(1,5)) if($exists(<name="q">)) { then { change attribute(<name="q">,"value",$nothing) wait($rand(1,5)) type text(<name="q">,#keywords,"Standard") wait($rand(1,5)) } else { alert("ERROR ALERT: Cannot detect \"Search Box\"! Quitting the session.") stop script } } set(#current url,$url,"Local") comment("Click Search Button.") if($exists($element offset(<tagname="svg">,1))) { then { click($element offset(<tagname="svg">,1),"Left Click","No") } else { alert("ERROR ALERT: Cannot detect \"Search Button\"! Quitting the session.") } } wait($rand(1,5)) clear list(%urls) loop while($both($comparison($list total(%urls),"<= Less than or equal to",#max results),$either($exists(<id="pnnext">),$exists(<outerhtml="<span style=\"display:block;margin-left:53px\">Next</span>">)))) { add list to list(%urls,$scrape attribute(<tagname="a">,"fullhref"),"Delete","Global") set(#current url,$url,"Local") if($exists(<id="pnnext">)) { then { comment("Click for \"Next\" Result.") click(<id="pnnext">,"Left Click","No") } else { if($exists(<outerhtml="<span style=\"display:block;margin-left:53px\">Next</span>">)) { then { comment("Click for \"Next\" Result.") click(<outerhtml="<span style=\"display:block;margin-left:53px\">Next</span>">,"Left Click","No") } else { alert("ERROR ALERTt: Cannot detect \"Link to NEXT Page\"! Quitting the session.") divider } } divider } } divider wait for browser event("Page Loaded","") } save to file(#save to,%urls) [/code] What's your code to get it to click the round search button that's on the leftside of the search box ? Quote Link to post Share on other sites
PRO 69 Posted September 5, 2021 Report Share Posted September 5, 2021 Try this: type text(<name="q">,"\{ENTER\}","Standard") Feel free leaving a like if this solved your problem. 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.