Jump to content
UBot Underground

Click on google search result


Recommended Posts

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

 

Link to post
Share on other sites

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)
}

Link to post
Share on other sites

 

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

Link to post
Share on other sites

It worked just ok here, I guess you need to modify it a bit for your needs.

Hi

it'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

Link to post
Share on other sites

Hi

it'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

Sorry, you may be right and you should use * instead of 1 there (I've edited my code).

 

EDIT: Ok, great to hear.

Link to post
Share on other sites

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

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.

Link to post
Share on other sites

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

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...