funtoosh 4 Posted April 2, 2014 Report Share Posted April 2, 2014 Hi I'm trying to make my bot click on one of the google search result. Suppose if i want to click on a link from hostgator.com (the url will be dynamic so i store it in a variable, depends upon the user input) Below is the code that i get in Advance Elemect Editor <a href="http://www.hostgator.com/" onmousedown="return rwt(this,'','','','1','AFQjCNFFmhVQ_aV7g72Z7p7eg0bTq7MH2w','','0CDEQFjAA','','',event)"><em>HostGator</em>: Website Hosting Services, VPS Hosting & Dedicated <b>...</b></a> I tried the attribute href and i get the result <href="http://www.hostgator.com/"> But when the bot clicks on it, it opens the google cached page and not the actual page I want to open the actual page, what am i doing wrong ? Thanks Quote Link to post Share on other sites
UBotDev 276 Posted April 2, 2014 Report Share Posted April 2, 2014 As you noticed you are getting to a wrong page, which means you are clicking the wrong button (cached one). Instead you should be clicking the result title with code similar to this: set(#INPUT Keyword, "test.com", "Global") clear list(%RESULTS) add list to list(%RESULTS, $scrape attribute(<onmousedown=w"return rwt(this,'','','','*','*','','*','','',event)">, "href"), "Delete", "Global") set(#RESULTS Row, 0, "Global") loop($list total(%RESULTS)) { if($contains($list item(%RESULTS, #RESULTS Row), #INPUT Keyword)) { then { click($element from text("<(href=\"{$list item(%RESULTS, #RESULTS Row)}\" AND onmousedown=w\"return rwt(this,\\\'\\\',\\\'\\\',\\\'\\\',\\\'1\\\',\\\'*\\\',\\\'\\\',\\\'*\\\',\\\'\\\',\\\'\\\',event)\")>"), "Left Click", "No") } else { } } increment(#RESULTS Row) } Quote Link to post Share on other sites
funtoosh 4 Posted April 3, 2014 Author Report Share Posted April 3, 2014 As you noticed you are getting to a wrong page, which means you are clicking the wrong button (cached one). Instead you should be clicking the result title with code similar to this: set(#INPUT Keyword, "test.com", "Global") clear list(%RESULTS) add list to list(%RESULTS, $scrape attribute(<onmousedown=w"return rwt(this,'','','','1','*','','*','','',event)">, "href"), "Delete", "Global") set(#RESULTS Row, 0, "Global") loop($list total(%RESULTS)) { if($contains($list item(%RESULTS, #RESULTS Row), #INPUT Keyword)) { then { click($element from text("<(href=\"{$list item(%RESULTS, #RESULTS Row)}\" AND onmousedown=w\"return rwt(this,\\\'\\\',\\\'\\\',\\\'\\\',\\\'1\\\',\\\'*\\\',\\\'\\\',\\\'*\\\',\\\'\\\',\\\'\\\',event)\")>"), "Left Click", "No") } else { } } increment(#RESULTS Row) } Thanks, but it does not seems to work either Quote Link to post Share on other sites
UBotDev 276 Posted April 3, 2014 Report Share Posted April 3, 2014 Thanks, but it does not seems to work eitherIt worked just ok here, I guess you need to modify it a bit for your needs. Quote Link to post Share on other sites
funtoosh 4 Posted April 3, 2014 Author Report Share Posted April 3, 2014 It worked just ok here, I guess you need to modify it a bit for your needs.Hiit's working for you as you are using a constant in add list to list(%RESULTS, $scrape attribute(<onmousedown=w"return rwt(this,'','','','1','*','','*','','',event)">, "href"), "Delete", "Global")You are using "1" but i don't know what will be rank of the site i'm searching for so it keeps changing with result, if i use a static value it will work but not with dynamic value Please rectify me if i'm wrong, still new to ubot Also if you know a solution to fix it as well, please do reply Thanks Quote Link to post Share on other sites
funtoosh 4 Posted April 3, 2014 Author Report Share Posted April 3, 2014 Woot, just fixed it Quote Link to post Share on other sites
UBotDev 276 Posted April 3, 2014 Report Share Posted April 3, 2014 Hiit's working for you as you are using a constant in add list to list(%RESULTS, $scrape attribute(<onmousedown=w"return rwt(this,'','','','1','*','','*','','',event)">, "href"), "Delete", "Global")You are using "1" but i don't know what will be rank of the site i'm searching for so it keeps changing with result, if i use a static value it will work but not with dynamic value Please rectify me if i'm wrong, still new to ubot Also if you know a solution to fix it as well, please do reply ThanksSorry, you may be right and you should use * instead of 1 there (I've edited my code). EDIT: Ok, great to hear. Quote Link to post Share on other sites
funtoosh 4 Posted April 3, 2014 Author Report Share Posted April 3, 2014 Using * won't help as it will then match all search results, i've used the outerhtml tag with some wild cards and it worked Thanks again Quote Link to post Share on other sites
UBotDev 276 Posted April 3, 2014 Report Share Posted April 3, 2014 Using * won't help as it will then match all search results, i've used the outerhtml tag with some wild cards and it worked Thanks againAdding * will scrape all a tags that use onmouseover attribute and it has nothing to do with finding the domain, since we search for the domain name with this line: if($contains($list item(%RESULTS, #RESULTS Row), #INPUT Keyword)) { ..and not with the offset. Quote Link to post Share on other sites
funtoosh 4 Posted April 3, 2014 Author Report Share Posted April 3, 2014 Adding * will scrape all a tags that use onmouseover attribute and it has nothing to do with finding the domain, since we search for the domain name with this line: if($contains($list item(%RESULTS, #RESULTS Row), #INPUT Keyword)) { ..and not with the offset. Yeah you are right, though not sure why it did not worked for me , but anyways thanks for your help Cheers 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.