Saturday, December 13, 2008

Selenese flowControl extensions

Usually, we don't need to do conditional logic in Selenese table. Selenium RC programming language is more suitable for complex logic. But sometimes we still want to add some conditional steps in Selenese, like if...else, while.

Fortunately, there are already flow control extensions on openqa's wiki.
http://wiki.openqa.org/display/SEL/flowControl

It can meet most of flow control requirements for Selenese. We still recommend use RC to implement more complicated logic.

Also some people work on both Core and IDE. They found this extensions not work on IDE. It's a CORE version.

One guy contributed an IDE version: http://51elliot.blogspot.com/2008/02/selenium-ide-goto.html. IDE user can also use it.

So I combined them to a unified flowControl extensions: support both IDE and CORE.

The simplest code:
var sel_locstr = window.location.href;  
if(sel_locstr.indexOf("selenium-ide.xul") != -1){ //IDE mode      
   // paste IDE extension here
}else{//Core mode
   // paste Core extension here
} 
Enjoy!

No comments:

Post a Comment