Rahul Chaturvedi wrote on 11/14/2005 03:17:16 AM:
> Problem:
> depending upon some condition I need to verify some text or click some
> link.(viz: If some element/text is present then only do something 
> otherwise do something else)
> following is the rough flow chart kind of thing just to make it more 
clear:
> (in my test case I want a feature like this)-
> if (some condition )
> then 
> command|target|value 
> else 
> command|target|value 
> 
> This condition is picked up from the page its showing.
> How can this be done ?
> Your urgency in replying will be highly appreciated.

I think we should add this kind of syntax to "tables-mode" Selenium tests. 
I don't think it's even hard to do. The problem is that each new syntax or 
command we add is organic and evolutionary. When you develop a language 
that way (without design) you get Perl and PHP. Yuck. So my hesitation in 
adding new syntax is to make sure it fits into a larger vision of the 
future of the syntax. If I can satisfy that fear, then I'd say let's do 
it. Regardless, Selenium could use some kind of "Master Plan". Of course, 
in developing that plan, we'll need to be careful to avoid the "You Ain't 
Going To Need It" aspects of "Big Design Up Front" :-)

At the moment, Selenium "table tests" work great when you *don't* need 
conditionals or looping. The classic case for "table-style" Selenium is 
"click this, do that, verify this, done." 

If you need programming logic like conditionals and looping, the commonly 
used technique is to use one of the language specific drivers (Perl, 
Python, Ruby, Java, etc.) and use all the tools available to you in those 
"real languages". The problem with those drivers is that they are more 
complex to instrument correctly, and they require a "driving" process (on 
the client or server) to send commands to the browser. With those drivers, 
you get all the advantages of a "real" language, but you lose the 
simplicity of just going to the TestRunner.html page and clicking "run". 

The middle of the road option is doing all the complex stuff in a Selenium 
users command written in JavaScript and call it from your Selenium test.

Hope this helps!

-Jason Huggins
_______________________________________________
Selenium-users mailing list
Selenium-users@lists.public.thoughtworks.org
http://lists.public.thoughtworks.org/mailman/listinfo/selenium-users

Reply via email to