Jump to content
UBot Underground

Why Doesn't This Work?


Recommended Posts

This is so basic it seems it should work but it doesn't:

set user agent("Android")
navigate("http://www.google.com/alerts", "Wait")
if($comparison($search page("Sign In"), "=", $true)) {
    then {
        alert("yes")
    }
    else {
        alert("no")
    }
}

When I CTRL + F in Firefox it finds 'Sign In' no problem but Ubot doesn't seem to.

 

Any ideas?

Link to post
Share on other sites

The problem is that the page doesn't load instantly and you actually need to wait for the page to load. The safest way to do this is to use "wait for element" command right after "navigate" command, but FYI there are also other wait commands that you can use.

Link to post
Share on other sites

hey man! long time no talk!! :)

 

what you recommended doesn't seem to fix it for me. I added the line:

wait for element($element offset(<login link>, 0), "", "Appear")

right under the navigate command but it still alerts "no"

Link to post
Share on other sites

Hey botmaker,

 

Use exists instead of comparison.

 

 

Working code

set user agent("Android")
navigate("http://www.google.com/alerts", "Wait")
if($exists(<innertext="Sign in">)) {
    then {
        alert("yes")
    }
    else {
        alert("no")
    }
}

Link to post
Share on other sites

Having search page for "sign in" is to generic. The words can be in muliplte spots on page thus giving bad results. Thats why exist works better.

Link to post
Share on other sites

hey man! long time no talk!! :)

 

what you recommended doesn't seem to fix it for me. I added the line:

wait for element($element offset(<login link>, 0), "", "Appear")

right under the navigate command but it still alerts "no"

Ah right, I didn't even notice...a2mateit is right. You should use $exist command instead of  comparsion->search page.

 

But still, you need that "wait for element" command.

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...