run a script in selenium-ide from the command line?

604 views
Skip to first unread message

queshaw

unread,
Mar 23, 2009, 2:40:52 PM3/23/09
to selenium-users...@googlegroups.com
Can I launch selenium ide from the command line and have it execute a test case or test suite? Not using selenium-rc.

The idea is that selenium ide and selenium rc seem to behave differently. I want to execute tests that were recorded in the ide, automatically, without having a programmer change the scripts to get them to work, or I want to know some programmatic way to transform the scripts so they will work in selenium-rc the way that they work in the ide.

Dima Kovalenko

unread,
Mar 23, 2009, 3:23:32 PM3/23/09
to selenium-users...@googlegroups.com
I'm sure there is a way to make this happen, but it will not be pretty.

If you are using a mac, you can probably use a combination of Apple scripts and Automator

If you are on windows, there are a couple of apps that will let you take over the OS level calls (such as click here, type here, etc...)

You can rig up something, but to be honest, i think it will be easier for you to work with RC.

Once you have RC setup, you can record your test in the IDE, then in the IDE go to "Options>Format" and choose the lanague you want the output to be in. You will quicly recognize a lot of similar things between the HTML look in the IDE and say Java or Ruby output (Ruby being my favorite because it is much easier to use).

In short, if you want an external application to launch firefox, selenium and run all the tests in the IDE, it will take a lot of work to hack something together that will take over your computer's OS and click ont he launch button etc... Even if you get this accomplished, all your scripts will be very flacky, because if the window oppens an inch to the left of where you expect it, the computer will click in the wrong place and nothing will happen. This means when the test is running, no one else is allowed to touch, looke or even breath on the computer.

It's much more time efficient and stable to use RC.

queshaw

unread,
Mar 23, 2009, 3:45:32 PM3/23/09
to selenium-users...@googlegroups.com
That is helpful, thanks. I'm now trying to see if there is something ready to automate X applications too.

But, would I'd really like is some command line option to cause the IDE to execute a script, so at least the IDE could be used for testing firefox.

Another way to put my various questions is: Is selenium a product that can be used to have non-programmers record scripts and can a program later take those scripts and execute them? Or, is selenium fundamentally a program that either requires a human to robotically execute recorded scripts, or that requires a programmer to fix up every script? If it is the later, selenium becomes very much less useful for my purposes.

Dima Kovalenko

unread,
Mar 23, 2009, 4:08:04 PM3/23/09
to selenium-users...@googlegroups.com
Gotcha, well being in QA i run into the position of having to type out the steps to replicate a bug in step by step sequence.

What i found out is, I can record a script in IDE and then save it as HTML file, then attach the HTML file to the bug report so that the developer can run it on his own IDE instance.

So, the easiest way to share the recorded selenium scripts is, after you are finished recording, go to File>Save Test Case, and save the file as HTML. Then on the other IDE, you can go to File>Open and open the test case you just recorded.

Take this with a little grain of salt, because most people come to conclusion that "Record/Playback" is a big marketing scheme, and there is not a single test application that will work perfectly like that. If the page loading times change, or the text is re-written on the website, some things that expect those fluid references might break.

I'll recomend a couple of suggestions so that one person can record a script and another person can run it easily.

1) add sleep, and wait commands everywhere while recording. If you recorded a click to submit a query, add a "wait for page to load" command after the click.
2) If you going to add some asserts, or verifications, make sure you check for text that you know wont change too often, or your script will just fail
3) make sure you are aware if developers change the IDs and Names of elements often, because that might break things.

\\ But you can give selenium IDE to some non-techy people and have them record scripts like they would and give them to programmers. Programmers might have to add some short delays and sleeps here and there, but it will work just fine 98% of the time.

Reply all
Reply to author
Forward
0 new messages