Thursday, December 17, 2009

Cross Browser Testing using Selenium

1. Record the entire script and then stop it.
2. Either you can go to File --> Export Test Case as -->Select your preferred language (here i'll take an example of java i.e. Java (Junit) - Selenium RC )
or
After recording the script just go to Options --> Format --> Java (Junit) - Selenium RC then copy the entire script
3. Then open your IDE for ex: Eclipse and then paste the script
4. then you can start the server which comes with the Selenium server
Go to Selenium-server folder using command prompt and then use the command java - jar selenium-server.jar
then the server will start
5. Now in eclipse you can run the script by default it will run in firefox

if you want to run in different browser then you have to change *chrome in the below mentioned code in you script to iexplore for running it in Internet Explorer

setUp("http://change-this-to-the-site-you-are-testing/", "*chrome");


Below have mentioned the codes for different browsers

firefoxproxy = FirefoxCustomProfileLauncher
firefox = FirefoxLauncher
chrome = FirefoxChromeLauncher
firefoxchrome = FirefoxChromeLauncher
firefox2 = Firefox2Launcher
firefox3 = Firefox3Launcher
iexploreproxy = InternetExplorerCustomProxyLauncher
safari = SafariLauncher
safariproxy = SafariCustomProfileLauncher
iehta = HTABrowserLauncher
iexplore = InternetExplorerLauncher
opera = OperaCustomProfileLauncher
piiexplore = ProxyInjectionInternetExplorerCustomProxyLauncher
pifirefox = ProxyInjectionFirefoxCustomProfileLauncher
// DGF pisafari isn't working yet
//pisafari = ProxyInjectionSafariCustomProfileLauncher
konqueror = KonquerorLauncher
mock = MockBrowserLauncher
googlechrome = GoogleChromeLauncher



then your test will launch the browser and starts running.......in the browser you have chosen

No comments:

Post a Comment