Skip to main content

Posts

Showing posts from January, 2011

Testing auto suggest using Selenium

Happened to work on Auto Suggest feature of late and was to automate it using Selenium. Auto Suggest feature is similar to suggestion list which is displayed when user types in search term in Google or Yahoo search boxes and a suggestion list is displayed for typed in term. Started my experiments with "type()" method of selenium but of no avail. browse through a couple of site and found others have had success using native key press methods. But did not work with me. Then came across combination of using both "type" and "typeKeys" and voila it worked. selenium.type(getPageElement("AutoSuggest", "SearchBox").trim(), ""); selenium.typeKeys(getPageElement("AutoSuggest", "SearchBox").trim(), searchTerm); Though still have some intermittent problems which cause a letter in search term to not be typed in search box in a random fashion, but can live with it for now :-) ~T

Selenium Page Objects

Have been reading about page objects in selenium of late and came across a couple of pointers which I wanted to share here - 1. If user action causes ctrl to appear on a different page then that corresponding page object should be returned else same page object should be returned. 2. Test code (Verification/Assertion) should be included in test and should not be part of page Objects them selves 3. Page object need not represent entire page, it may represent part of page which may appear on site multiple times or multiple times on same page. 4. Page Object offers the services represented by that page. Reference: http://www.slideshare.net/dantebriones/using-the-page-object-pattern http://www.theautomatedtester.co.uk/tutorials/selenium/page-object-pattern.htm http://code.google.com/p/selenium/wiki/PageObjects of late contributed an article on Page Object on Selenium Head Quarter. It could be found here .