I need to make my selenium scripts dynamic (small changes on the application or different server response times never make my scripts fail). Would you please suggest some scripting methods so that I can achieve this?
Note :Am using Junit(Remote Control) scripts for testing.
The key is only use record and playback as a reference, not as actual code you use.
To avoid wait time issues, use configurable time outs, and intelligent waits, whether it's a wait method, or if you need to poll for the object. For every action you perform, make sure you get a response back before continuing. Like if you click a submit button, wait till the button is either depressed or the browser is loading the next page before continuing.
To avoid problems in object recognition. Try to use stable properties. I believe the Selenium developers recommend using CSS selectors as those are the same set of properties the UI designer will use to create their style sheets, or name/id selectors as that's what a backend dev would use to identify the object. XPATH is generally frowned upon as depending on how it's written it can be fragile (for simple path selection queries) or become resource intensive (for more complicated queries).
Also use Page objects when possible. It'll make the code easier to maintain.
Develop your own framework using JUnit which has the following properties:
1. Configurable using external properties file
2. Should wait some time if the object is not loaded
3. Should generate useful results
4. Parametrized using some external means (i.e. Excel, XML, database, etc)
5. Selenium 2.0 WebDriver provides APIs for page objects, utilizing these generate reliable tests