Jump to content
UBot Underground

Define From Button Not Working Correctly - But Separated In Tabs Works Fine?


Recommended Posts

Hey there

 

While finishing the first bot, i am running in more and more problems. 

Most of my defines will be fired by a button (html ui). 

But they run not completely through.

 

I do not get the last alerts.

In this example the #CollectorStatus will not be set, which i would like to use as an indicator of success or not.

This is a search and collect profiles function.

define gosearch {
    wait for browser event("DOM Ready","")
    navigate("https://www.xing.com/search/members?keywords={#search}","Wait")
    wait(4)
    loop(2) {
        set(#CollectorStatus,"<div class=\"alert alert-primary\" role=\"alert\">
  <div class=\"loader\"></div>   Visiting Profiles
</div>","Global")
        add list to list(%ProfileUrlsCollector,$scrape attribute(<class="name-page-link">,"href"),"Delete","Global")
        click(<class="foundation-icon-shape-arrow-right">,"Left Click","No")
        wait for browser event("DOM Ready","")
        wait(2)
    }
    add list to list(%ToVisitProfilUrls,$list from text($replace(%ProfileUrlsCollector,"/profile","https://xing.com/profile"),$new line),"Delete","Global")
    set(#CollectorStatus,"<div class=\"alert alert-success\" role=\"alert\">
 Done - besuche die Profile mit dem Profile Visitor.
</div>","Global")
    wait(2)
    set(#botfolder,$folder exists("{$special folder("Desktop")}\\XngVisitor"),"Global")
    if(#botfolder) {
        then {
            save to file("{$special folder("Desktop")}\\XngVisitor\\tovisit.csv",%ToVisitProfilUrls)
            alert("FileSaved")
        }
        else {
            create folder($special folder("Desktop"),"XngVisitor")
            save to file("{$special folder("Desktop")}\\XngVisitor\\tovisit.csv",%ToVisitProfilUrls)
            alert("FileSaved")
        }
    }
    alert("EverythingDone")
}

This example should check if a specific text exists on the page - but the check does not happen.

This is a login function.

define login {
    navigate("http://login.xing.com","Wait")
    wait for browser event("DOM Ready","")
    ui text box("Account Email",#email)
    set table cell(&Creds,0,0,#email)
    type text(<email field>,#email,"Standard")
    ui password("Xing Passwort",#pass)
    set table cell(&Creds,1,0,$encrypt(#pass,"base64"))
    type text(<password field>,#pass,"Standard")
    save to file("{$special folder("Desktop")}\\XngVisitor\\settings.csv",&Creds)
    click(<name="button">,"Left Click","No")
    wait for browser event("DOM Ready","")
    wait(2)
    if($search page("Eingabe gerade leider nicht erkannt")) {
        then {
            set(#LoginStatus,"<div class=\"alert alert-danger\" role=\"alert\">
  Bitte einloggen oder Email bzw. Passwort überprüfen.
</div>","Global")
        }
        else {
            set(#LoginStatus,"<div class=\"alert alert-success\" role=\"alert\">
  Yes - eingeloggt. Auf gehts!
</div>","Global")
        }
    }
}

Does anyone see some mistakes i made?

 

While starting/testing out my scripts in different tabs, everything worked out fine.

As i combined all code in one tab now and structuring everything into commands - i get a lot of uncool behaviour.

 

 

 

Link to post
Share on other sites

Hm, working fine as tab-standalone script, but in a define function, it sometimes get stuck.

It is an older Version (5) from a friend, which i use to check if ubot is the go-to tool for me - before investing almost 1k of dineros :-)

Link to post
Share on other sites

Yes, sometimes it skips the first, sometimes the last commands. Sometimes it works perfectly fine, mainly after restarting ubot.

Might this be a problem with the ubot version - or is this usual behaviour and can happen?

Link to post
Share on other sites

unibotsi says: It is an older Version (5) from a friend, which i use to check if ubot is the go-to tool for me - before investing almost 1k of dineros :-)

 

Sounds a little suspicious... maybe you got the version of ubot that can detect that it has been cracked and as a defense it provides erratic results so that you cannot profit from it without first paying for it.

 

But - I could be wrong :-)

  • Like 2
Link to post
Share on other sites
  • 1 month later...

Nope - still the same with the new, personally bought Ubot X Version.

Works fine in a standalone tab, but bugging with whole script in one tab.

 

Maybe this is an known error, maybe to much script per tab?

The whole script is about 400 lines, 500 List items in two lists and maybe 15 different variables.

So not much i guess?!

Link to post
Share on other sites

I see a couple of things wrong you may want to address before you continue.

 

1- you call for a browser wait event before you even call the browser....so you'll want to put that immediately after the navigate call... This isn't something that will cause a break, but it is useless the way you have it displayed via your posted code.

 

2- the next thing that comes to my attention is an if statement on the page.... you have it as: [if] #variable [then]..... that isn't how things work. Instead, you need to give the [if] statement something to work with... like, "contains", or "comparison", or "exists", else, I don't think it would ever save your file.

  • Like 1
Link to post
Share on other sites

Thanks for the input! I always appreciate that!

Though it is hard to "reproduce", as i do not know where you are referring to  :D

 

1. If you are referring to the first wait event - this one looks weird, but it follows a navigate from the previous step.

 

2. I guess you are referring to the #botfolder variable - this one is a true or false variable (checking if the save folder is available) which i use very often, so i did store the value as boolean. All files are saving perfect.  :)

 

Btw, do you use Ubot X?

Using it "brutally" since some hours, have to restart very often now as it crashes a lot  :blink:

Link to post
Share on other sites

2- the next thing that comes to my attention is an if statement on the page.... you have it as: [if] #variable [then]..... that isn't how things work. Instead, you need to give the [if] statement something to work with... like, "contains", or "comparison", or "exists", else, I don't think it would ever save your file.

 

You can actually do that if the variable is true or false

set(#bool,"true","Global")
if(#bool) {
    then {
        alert("I am true!")
    }
    else {
        alert("I am false!")
    }
}
  • Like 2
Link to post
Share on other sites

Still having those Problems.

 

 

I wrote this simple Script, where the Search should start by clicking the "Go" Button. Does not work, nothing runs.

ui button("Go") {
define Google Search {
       navigate("http://google.com","Wait")
        type text(<name="q">,"Hello World","Standard")
        click($element offset(<name="btnK">,1),"Left Click","No")
    }
}

Neither does this script run, if pressing the "Run" button in Ubot header. Also does "right click" in the define header and "Run node" not work.

define Google Search {
        navigate("http://google.com","Wait")
        type text(<name="q">,"Hello World","Standard")
        click($element offset(<name="btnK">,1),"Left Click","No")
}

Am i missing something?

Edited by unibotsi
Link to post
Share on other sites
ui button("Go") {
    Google Search()
}
define Google Search {
    navigate("http://google.com","Wait")
    type text(<name="q">,"Hello World","Standard")
    click($element offset(<name="btnK">,1),"Left Click","No")
}

omg Try this, happy new year to all

Link to post
Share on other sites

I mean not to write the whole define tasks into a button.

 

I did:

Button {the whole google search define command}

The working solution:

Button{just the custom command}

Define {the google search command}

With outsourcing i mean, not putting the search tasks as define into the button command.

The define is on its own and the button just calls the custom command.

 

  1. Why does it not work like i did it at the beginning?
  2. Is it better to have a tab, where i write down all my defines and call them as custom commands in the main tab where i have my UI?
Link to post
Share on other sites

You must call a custom command/function after you define it to use it. You can (and probably should) define your custom commands in other tabs which are labeled and organized and then call them from the main script.

 

Example:

comment("This part is ran")
MyCommand()
divider
divider
comment("You can call this as many times as you want")
MyCommand()
divider
divider
divider
divider
comment("This is the defined code
it is only ran when you call MyCommand
not when the script gets here (then it is skipped)")
define MyCommand {
    alert("hi")
}
  • Like 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...