General guidance:Script should be in following form:
[URL]
.............. some url here ......
[ACTIONS]
............... commands here ........
Here, string after [URL] specifies any valid URL to start. Everything after [ACTIONS] is script to execute.
[URL]
http://www.microsoft.com
[ACTIONS]
scrollto down 500
pause 5
set test 50
IF check test = 50 {
scroll up
}
{
}
Commands:scroll down / scroll up
Scrolls full page down or up.
scrollto down [x] / scrollto up [x]
Scrolls page down or up for [x] pixels.
examples:
scroll down 50 - scrolls 50 pixels down
scroll up 100 - scrolls 100 pixels up
focus [element name]
Sets focus to element with name [element name].
example:
focus pic1 - sets focus to element "pic1"
click [element name]
Simulates user click on element with name, or id, or conaining text [element name]. It case of contained text it's something like <button ... value=[element name]>
example:
click button1 - clicks on button "button1"
followlink [text]
Simlates click on link with text [text]. If [text] contans several words it shold be quoted.
examples:
followlink examples - clicks on link examples
followlink "So text" - clicks on link "Some text"
findelement [word]
Finds element with name containing [word] and focuses on it.
type [element name] [text]
Type [text] in element [element name]. If [text] contans several words it shold be quoted.
examples:
type textfield Greetings! - types "Greetings" in field named textfield
type textfield "Many words" - types "Many words" in field named textfield
pause [time]
Pauses script execution for [time] seconds.
example:
pause 50 - pauses for 50 seconds
navigate [url]
Navigates to specified [url]
example:
havigate http://www.mail.ru - navigates to http://www.mail.ru
set [variable] [value]|[operator]
Sets variable with name [variable] value to [value]. If [operator] specified instead of [value] corresponding action execuded.
[operator] can be either ++ or --, wich means increment or decrement correspondingly.
examples:
set my_var 10 - sets my_var variable to 10
set my_var ++ - increments my_var
goto [label]
Goes to label [label]. Label can be set using any single word on line.
example:
my_label
....... some code here ......
goto my_label - jumps to label my_label
setCSSproperty [element name] [property] [value]
Set SCC property [property] of element [element name] to value [value].
example:
setCSSproperty body background-color #ffff00 - set background color of page body to #fff000
zoom [level]
Zooms page with zoom level [level].
example:
zoom 50 - zooms page to 50% level
execute [filename]
Executes script contained in file [filename].
example:
execute c:\script.txt - start executing c:\script.txt
back
Goes to previous browser page.
return
Returns from cycle of condition block.
Cycles:Cycles defined by using following construc:
{[x]
.......
}
where [x] is number of times block should execute.
*Conditions:*
Conditions basically defined like that:
IF [condition] ......
}
{
......
}
If {"[condition] evaluated sucessfully first block of code is executes. If not - second.
[condition] can be one of the following:
wordonpage [word]
Checks if there is a word [word] on page.
havelink [text]
Check if there's a link this text [text] on page. If [text] contans several words it shold be quoted.
minlinks [num]
Checks if there's a minimum of [num] links on page/
check [variable1] [operator] [variable2]|[value]
Checks if [operator] is sucessfully eveluated on variable [variable1] and either variable [variable2] or value [value].
[operator] can be one of the following: =, !=, <, >
example:
IF check test = 51 checks if variable test equals 51
IF check a != b checks if variable a not equals variable b
encoding_is [encoding]
Check if page has a particular encoding defined by [encoding].
havetext [text]
Checks if there's a text [text] is on the page. [text] hold be quoted.
================
Here's a sample script as an example:
[URL]
http://www.rian.ru
[ACTIONS]
scrollto down 500
pause 5
set test 50
IF check test = 50 {
scroll up
}
{
}
set test ++
IF check test = 51 {
setCSSproperty body background-color #ffff00
pause 5
type query ЗАРАБОТАЛО!
pause 5
}
{
}
followlink "Культура и шоу-бизнес"
{5
zoom 50
pause 2
zoom 100
pause 2
}
pause 5
back
focus query
pause 5
type query проверка
pause 10
click поиск
pause 10
IF havelink microsoft {
back
followlink Карикатура
pause 5
}
{
navigate http://www.microsoft.com
}
scrollto down 200
scrollto up 100
pause 10
scrollto down 200
scrollto up 100
navigate http://www.mail.ru
pause 5
followlink Софт
pause 5
scroll down
pause 5
scroll up
findlink Hashtable
pause 5
navigate http://www.rian.ru