Cross browser testing – Selenium with IE, Chrome and Mozilla browser

Testing your web application across different browsers to make sure:

  • Application performs similar manner for different browsers.
  • Webelements should be working as expected.(Active or inactive)
  • Application should have same font and color for objects.
  • Length/width of fields should be same across browsers.

Test case: log in to mercury tour website and verify the page title.

For this we will use selenium java and testNG framework.

  • Use testng.xml to send parameters as firefox / ie / chrome, to the
    selenium code for the testcase to execute on any one of the browser.
  • Make sure to have some value to parallel attribute in testng.xml.
  • Place chromedriver.exe and IEDriverServer.exe under your project folder for ease of access.

Notes for the Selenium with IE browser:

  • Make sure the browser zoom level is set to 100%.
  • Protected mode setting should be wither enable / disable for all the zones (Internet, local inranet, trusted sutes and restricted sites), can be accessible by navigating to IE browser manubar Tools -> Internet Options -> Security Tab.
  • Add few lines before declaring the InternetExplorerDriver

    Test case: log in to mercury tour website and verify the page title.

Selenium code should look like:
Created a package as mypckg and class as for the below code:

testNG.xml should be something like:

Now execute the code – Right click on the testng.xml, select “Run As” -> “TestNG Suite” and you are done! (for other ways of executing testng.xml, refer here)

Content posted is based on learning or working experience,
Share the post with others if find useful,
Any queries?, leave comments or discuss on our, Thanks!

1 Response

  1. December 30, 2016

    […] parallel attribute is set to none, as we want to run this suite once, when we want to run multiple times in different browser, we can set this attribute. please refer cross browser testing. […]

Leave a Reply

Your email address will not be published. Required fields are marked *