Jump to content
UBot Underground

How Ubot Pro Presses "ENTER" ?


Recommended Posts

Hiya,
 
How to get Ubot to click ENTER button ? Using Ubot Pro v5.
I need Ubot to type a keyword on Google Searchbox and press the ENTER button. Ubot 5 fails to detect the search button and so I'm failing to get Ubot to click it. Hence, need it to press the ENTER button after typing the keywords in the google search box.
 
Below code navigates to Google and types user's keywords in the search box. Now need to add code to get Ubot to press ENTER button after typing the keywords in the search button.
 
Code Context:
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

    }
}
 
 
 
Link to post
Share on other sites
Hello @Urgent Enquirer, this is how you can handle G Search with UBot natively (without plugins):
 
 
navigate("https://www.google.com","Wait")
wait(3)
comment("Click Google Consent Button if present")
click(<class="tHlp8d">,"Left Click","No")
wait(1)
navigate("https://www.google.com","Wait")
change attribute(<name="q">,"value","weather")
type text(<name="q">,"\{ENTER\}","Standard")
 
 
Feel free to leave a like if this helped you further.
  • Thanks 1
Link to post
Share on other sites
3 hours ago, PRO said:
Hello @Urgent Enquirer, this is jow you can handle G Search with UBot natively (without plugins):
 
 
navigate("https://www.google.com","Wait")
wait(3)
comment("Click Google Consent Button if present")
click(<class="tHlp8d">,"Left Click","No")
wait(1)
navigate("https://www.google.com","Wait")
change attribute(<name="q">,"value","weather")
type text(<name="q">,"\{ENTER\}","Standard")
 
 
Feel free to leave a like if this helped you further.

Thanks a bunch! You saved my night!

Now, what is this Google Consent Button ? I never came across it, ever.

And shouldn't we write code for Ubot to check if Consent Button exists or not and if it does then click the button.

Because, if it doesn't exists and we get Ubot to try to click something that doesn't exist then naturally we should get error that item (consent button) has not been found. When everytime I write code for Ubot to click something and if that something doesn't exist then i always used to get error that the item has not been found.

However, in your case, even though you don't get Ubot to check if the Consent Button exists or not and you downright get Ubot to click the button regardless whether it exists or not then we should've encounter an error here. But the funny thing is, we don't. How come ? I am puzzled. Scratching my head!

 

I would've coded it like this to avoid the "item has not been found" error ....

if($exists(<class="tHlp8d">)) {
    then {
        click(<class="tHlp8d">,"Left Click","No")
    }
    else {
    }
}

 

Edited by Urgent Enquirer
Fixing typos.
Link to post
Share on other sites

@Urgent Enquirer, welcome. I would say always write the simplest and shortest code that works for you.

I did no check to keep things as simple as possible. If no check needed, don't check.

This is how a Google Privacy Consent Page looks like:

BBywWhmjWu_Kjau52BvLrxGpigbPwwTnk6Pege5vPec.jpg

  • Thanks 1
Link to post
Share on other sites
2 minutes ago, PRO said:

@Urgent Enquirer, I would say, write the simplest code that works for you.

I did no check to keep things as simple as possible. If no check needed, don't check.

This is how a Google Privacy Consent Page loks like:

BBywWhmjWu_Kjau52BvLrxGpigbPwwTnk6Pege5vPec.jpg

@Pro

Cheers!

But I'm having trouble scraping the search results. Didn't encounter this in past since 2011. Botted 2011-2017. Now getting back at it after 4years break.

add list to list(%urls,$scrape attribute(<(tagname="h3" AND outerhtml=w"<h3 class=\"LC20lb DKV0Md\">*</h3>")>,"fullhref"),"Delete","Global")


How you do the scraping ?

Edited by Urgent Enquirer
Link to post
Share on other sites

@Urgent Enquirer, Yes, I know they make it not exactly easy to figure out. On the SERPs especially, they use the same classes a lot for the DOM elements and other things that make it hard selecting and interacting with desired elements.

I did this for a rather educational purpose a few months back. Needs me more time to read through my previous code (have a lot in hundreds of files). Another user also asked this. 

As soon I have time to investigate my old code or do a new one, I let you know. Till then I can only say, it should be possible with some advanced XPath (combination of selectors).

  • Thanks 1
Link to post
Share on other sites

I made a mistake here:

add list to list(%urls,$scrape attribute(<(tagname="h3" AND outerhtml=w"<h3 class=\"LC20lb DKV0Md\">*</h3>")>,"fullhref"),"Delete","Global")

 

Can you spot the mistake ? I have been corrected now.

Link to post
Share on other sites
On 9/5/2021 at 12:36 PM, Urgent Enquirer said:

Now, what is this Google Consent Button ? I never came across it, ever.

 

Must be on a European ip address, thats due to gdpr, and has to be clicked to consent.

from the US we don't have the consent screen as gdpr is not forced here 

  • Thanks 1
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...