Establish

From UBot Studio
Revision as of 23:46, 15 March 2015 by LillyT (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

This command is a Flow Command. The establish command tests to see if the scripting environment (the webpage, a variable, a list, etc) is as it should be for the bot to run successfully.

Establish Message: The message that will be logged indicating that the state of the bot's environment is stable.


Example

clear all data
ui log view("Log")
purpose("Create an account")
navigate("http://www.ubotstudio.com/playground/simple-form","Wait")
establish("I am on the account creation page.",$search page("Sample Account Creation Form:"),"No") {
    alert("We were unable to find the correct page")
    pause script
}
type text(<username field>,"Seth","Standard")
type text(<password field>,"password","Standard")
type text(<first name field>,"Seth","Standard")
type text(<last name field>,"Turin","Standard")
type text(<about me textarea>,"I heart UBot Studio.","Standard")
click(<value="Submit">,"Left Click","No")
wait(3)
establish("The account was properly created",$search page("Account Created"),"No") {
    alert("The account was not created properly")
    pause script
}


Running the script logs two establish messages:

1. I am on the account creation page: Indicating that the bot is free to continue on with account creation.

2. The account was properly created: Indicating that the account was created without issue as a result of the state of the webpage.

When the log files are viewed, the following logs are found for the entirety of the script:


2015-03-15 21:00:36 [PURPOSE] Create an account
2015-03-15 21:00:37 [ESTABLISH] "I am on the account creation page."
2015-03-15 21:00:37    Already Established
2015-03-15 21:00:42 [ESTABLISH] "The account was properly created"
2015-03-15 21:00:42    Already Established


Establish.jpg

Personal tools
Namespaces

Variants
Actions
Navigation
Toolbox