Some times we need to submit a form multiple time with different data. To make the submission automated we can do that in Selenium RC easily.
At first capture the form submission by Selenium IDE and then edit this script in Selenium RC to accomplish the target. If you so much familiar with the target form then you can write the code directly in Selenium RC.
Ok, now i’m going to show this in my following example. I’ve used the .NET as client server for Selenium RC.
We will submit the Google search form 5 times with different keywords.
Note: To make the keyword entry dynamic I’ll create a method that will return random words. And I’ll call it from my test script.
So, Here is my random word generator method:
Here is my ‘Google search with dynamic keywords’ test script:
See my test script code, I’ve called the random word generator method from the Utility class.
You can write this method in the same test script file. But for future maintenance and using the same method in other test scripts, it is better to write in different class file and just call it in your test script when needed.