Jump to content
UBot Underground

Is This A Ubot Bug ? Ubot Clicks Link Instead Of Searching For Html Button On Page


Recommended Posts

Hi,
 
Ubot 5 is acting really really weird for 2 nights now doing my head-in..
What do you think the following code does ?
[code]
 
if($exists(<type="submit">)) {
    then {
        click(<type="submit">,"Left Click","No")
    }
    else {
        type text(<type="text">,"\{ENTER\}","Standard")
    }
}
 
[/code]
It checks if a button exists on the current page or not. Correct ?
(Checks on any webpage from any domain in the world. Designed it not to be restricted to a single site only).
 
BIG ISSUE:
Now the real issue is, instead of checking whether an html button exists on the page or not, Ubot goes and clicks the first link found in the Google Search Result Page when I run the following code in http://www.google.com.
Check it out yourself.
 
This is a bug. What's your opinion and test results ?
Test run the script using the STEP button.
 
Full Code to reproduce the Ubot bug ...
[code]
ui text box("Url",#ui textbox_url)
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(#navigate,#ui textbox_url,"Global")
set(#keywords,#ui textbox_keywords,"Global")
set(#save to,#ui save file_save to,"Global")
divider
navigate(#navigate,"Wait")
wait for element(<type="text">,"","Appear")
wait for element(<type="submit">,"","Appear")
wait($rand(1,5))
if($exists(<type="text">)) {
    then {
        change attribute(<type="text">,"value",$nothing)
        wait($rand(1,5))
        type text(<type="text">,#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 Box")
if($exists(<type="submit">)) {
    then {
        click(<type="submit">,"Left Click","No")
    }
    else {
        type text(<type="text">,"\{ENTER\}","Standard")
    }
}
wait($rand(1,5))
clear list(%urls)
loop while($both($comparison($list total(%urls),"<= Less than or equal to",#max results),$either($exists(<innertext="More Results">),$either($exists(<(tagname="a" AND innertext="Next")>),$exists(<(tagname="button" AND innertext="Next")>))))) {
    add list to list(%urls,$scrape attribute(<tagname="a">,"fullhref"),"Delete","Global")
    set(#current url,$url,"Local")
    if($exists(<innertext="More Results">)) {
        then {
            comment("Click for \"More\" Result.")
            click(<innertext="More Results">,"Left Click","No")
        }
        else {
            if($exists(<(tagname="a" AND innertext="Next")>)) {
                then {
                    comment("Click for \"Next\" Result.")
                    click(<(tagname="a" AND innertext="Next")>,"Left Click","No")
                }
                else {
                    if($exists(<(tagname="button" AND innertext="Next")>)) {
                        then {
                            comment("Click for \"Next\" Result.")
                            click(<(tagname="button" AND innertext="Next")>,"Left Click","No")
                        }
                        else {
                            alert("ERROR ALERTt: 

Cannot detect \"Link to NEXT Page\"!
Quitting the session.")
                            stop script
                        }
                    }
                    divider
                }
            }
            divider
        }
    }
    divider
    wait for browser event("Page Loaded","")
}
save to file(#save to,%urls)
 
[/code]
 
In the UI Text Box "Url", type: http://www.google.com.
In the UI Text Box "Keywords", type "bike" or any keywords for that matter.
In the UI Dropdown, select "20".
In the UI Save File, select a file where you want the scraped data to be dumped.
Link to post
Share on other sites

@Pro

 

Admin, why Ubot failing to scrape Google Search results with any of these two commands ?

I had originally had it like this:
 
add list to list(%urls,$scrape attribute(<tagname="a">,"fullhref"),"Delete","Global")
 
But it didn't scrape the google search result links.
And so changed it to this following which also is not scraping:
 
add list to list(%urls,$scrape attribute(<((tagname="h3" AND class="LC20lb DKV0Md") OR outerhtml=w"<h3 class=\"LC20lb DKV0Md\">*</h3>")>,"fullhref"),"Delete","Global")
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...