Galactic Civilizations 3
if and else statements in Selenium

if and else statements in Selenium

Category: Javascript.
Posted by on the 08/04/2014.
Last update on the 10/04/2014.

<<Previous tutorial    Next tutorial>>

Description

This tutorial explains how use « if » and « else » in your Selenium scripts.

Introduction

This tutorial requires that Selenium IDE is installed. It also requires that the plugin flowControl is installed. This tutorial has been done with Firefox.

if statements

The « if » command allows to add execution conditions in a Selenium script. Here is a usage example of « if » command:

store | true | var1
if | storedVars.var1
echo | I am in the if
endIf

Script selenium if

if else statements

The « else » command allows to use conditional statements of type « if ... else ... » in a Selenium script. Here is a usage example of « else » command:

store | true | var1
if | storedVars.var1
echo | I am in the if
else
echo | I am in the else
endIf

Selenium using if else

Boolean operators

The boolean operators that can be used in the condition ( if(...) ) are:

  • and: &&
  • or: ||
  • not: !
  • less than: <
  • greater than: >
  • less or equal: <=
  • greater or equal: >=
  • equal: ==
  • different: !=

You like this tutorial ?
Like this website in order to promote it on facebook !

<<Previous tutorial    Next tutorial>>

You like this tutorial ? Share it with your friends !
Partager sur Facebook Partager sur Twitter Partager sur Myspace Partager sur Stumbleupon Soumettre sur Reddit Partager sur Digg Ajouter à vos favoris Technorati Ajouter à vos favoris Live Ajouter à vos favoris Google Ajouter sur vos favoris Yahoo