Friday, 24 May 2013
Selenium - Adding User Extensions
Selenium - Adding User Extensions
Parametrization and looping is not supported in Selenium IDE so for that user extensions(.js) files
can be loaded in Selenium as below :
Go to Options
-> Options -> Selenium Core extensions -> Browse and load the .js files from your local machine.
Selenium IDE - Flow control and Looping statements
Selenium IDE - Flow control and Looping statements
Selenium IDE does not support Flow control and Looping statements like While,Goto directly.
So to achieve flow control and looping in Selenium IDE goto_sel_ide.js user extensions have to be added in Selenium Core Extensions.
User extension goto_sel_ide.js can be downloaded form here.
Adding Selenium Core Extensions:
To add user exstension in Selenium , goto Options >> Options >> Selenium Core extensions
Browse goto_sel_ide.js file from local disk and click ok.
After adding goto_sel_ide.js we can see while goto statements in the command list of the IDE.
Now lets see a simple While loop script :
We can use store command to save the initial value in variable counter.
Then in While we can use the value of counter via Storedvars and compare against any vlaue or vairable if required as shown below.
Before endWhile the value of counter needs to be increased whcih can be done in a javascript code enclosed in braces.
Sample script for While loop in Selenium IDE :
Selenium IDE does not support Flow control and Looping statements like While,Goto directly.
So to achieve flow control and looping in Selenium IDE goto_sel_ide.js user extensions have to be added in Selenium Core Extensions.
User extension goto_sel_ide.js can be downloaded form here.
Adding Selenium Core Extensions:
To add user exstension in Selenium , goto Options >> Options >> Selenium Core extensions
Browse goto_sel_ide.js file from local disk and click ok.
After adding goto_sel_ide.js we can see while goto statements in the command list of the IDE.
Now lets see a simple While loop script :
We can use store command to save the initial value in variable counter.
Then in While we can use the value of counter via Storedvars and compare against any vlaue or vairable if required as shown below.
Before endWhile the value of counter needs to be increased whcih can be done in a javascript code enclosed in braces.
Command
|
Target
|
Value
|
store
|
0
|
counter
|
while
|
storedVars.counter<3
|
|
Other statements
|
||
store
|
javascript{storedVars.counter++;}
|
|
endWhile
|
Sample script for While loop in Selenium IDE :
Subscribe to:
Posts (Atom)