Eval
Line 2: | Line 2: | ||
$Eval is a [[Math Functions|Math Function]]. | $Eval is a [[Math Functions|Math Function]]. | ||
− | A javascript enabled website must be open in the main browser in order for the eval function to run. | + | '''A javascript enabled website must be open in the main browser in order for the eval function to run. |
− | A blank browser will return blank results. | + | A blank browser will return blank results.''' |
'''Expression:''' the math or javascript expression being evaluated. | '''Expression:''' the math or javascript expression being evaluated. |
Revision as of 12:59, 22 January 2015
This function returns the results of executing a piece of javascript or simple mathematical equations. $Eval is a Math Function.
A javascript enabled website must be open in the main browser in order for the eval function to run.
A blank browser will return blank results.
Expression: the math or javascript expression being evaluated.
Example 1: Math Expressions
navigate("http://www.ubotstudio.com/playground/simple-form", "Wait") type text(<about me textarea>, $eval($add(4, 4)), "Standard")
Typing 4+4 into the eval function brings up a new function called the add function.
$eval($add(4, 4))
navigate("http://www.ubotstudio.com/playground/simple-form", "Wait") type text(<about me textarea>, $eval($subtract(4, 4)), "Standard")
The subtract function appears when 4-5 is typed into the eval function.
$eval($subtract(4, 4))
Going back to our original script:
Running the script will fill the field with the correct answer for 4-4.
Example 2: Running Javascript
Eval can also be used to run javascript.
In this example, the function runs a piece of javascript that returns set cookies from a website and sets the cookies to a variable. The cookies are also displayed in full in an alert window.
ui text box("Website URL:", #website) navigate(#website, "Wait") wait(2) set(#blue, $eval("document.cookie"), "Global") alert($eval("document.cookie"))
Type in a url to see what cookies the set command and the alert returns.