To Avoid Errors and Improve the performance of the Selenium automation coding(selenium RC+Java)
- Maintain a constant url while defining the setup(Instantiation of DefaultSelenium class) and selenium.open(url) to avoid the Permission Denied Error.
- Add the URL under Trusted sites to avoid Permission Denied Error
- If Changing from http to https, above mentioned 2 points would be an added advantage. But its advisable to use either http or https for any instance, or else, selenium would consider this as a foreign domain access and would throw permission denied error.
- To avoid the delays and speed up the automation run, avoid Thread.sleep() and wait commands as much as possible. Instead use waitForElementPresent and alternatively use webDriver which has much more feasibility with Selenium
- For Ajax related events, Avoid using selenium.typeKeys(), Instead use the combination of selenium.type & selenium.fireEvent. This approach gives more flexibility for ajax events
- For Ajax related drop down use for loop and verifyElementPresent to synchronise the time, Instead of wait command
- If test data is enormous(Multi dimensional or Multiple data like User Details-username, userid, password, etc), avoid declaring in the class files or property files. Instead use xml files and pharse the data using SAX parser.