Selenium Data Driven Framework : Running Test In Different Browsers

We accept Implemented loadWebBrowser() and  closeWebBrowser() functions In PREVIOUS POST to centralize browser loading activity. Now supposing you lot wants to run your webdriver  test In whatever other browser similar Google Chrome as well as then how volition you lot create It? Our framework should accept roughly facility to run selenium webdriver  test In your desired browser. Let us create It.


STEP 24
Prerequisite : All previous selenium information driven framework creation steps should live on Implemented. All previous steps link are given on THIS PAGE.

To run your selenium webdriver exam In another browser, We accept to modify our loadWebBrowser() function. Also nosotros accept to create properties file In our projection to shop the browser cite In which browser you lot wants to run your test. We volition utilization It to shop other properties too.

Download Required Files
You ask full 4 files for this step.
  1. SuiteBase.java
  2. Param.properties
  3. chromedriver.exe
  4. IEDriverServer.exe
To run your exam In Google Chrome or Internet Explorer browser, You accept to download Chrome driver "chromedriver.exe" as well as Internet Explorer Driver "IEDriverServer.exe" files. You tin download both .exe files from THIS PAGE In zipped format. 

You tin larn latest version of  "chromedriver.exe" file from THIS PAGE and "IEDriverServer.exe" from THIS PAGE too.

You ask modified SuiteBase.java file, as well as ask to add together newly created Param.properties file to run your exam on Chrome or Firefox or Internet Explorer browser. You volition larn both files past times downloading bellow given nothing folder.
So directly you lot accept all required 4 files. Copy glue them every bit described bellow.
  • Paste SuiteBase.java file on com.stta.TestSuiteBase Package.
  • Paste Param.properties file on com.stta.property Package.
  • Create novel folder alongside cite = "BrowserDrivers" nether your projection as well as put "chromedriver.exe" and "IEDriverServer.exe" Inside It.
Now your directory construction volition looks similar bellow.


Now you lot tin run your webdriver exam on your required browser. Only you lot accept to alter testBrowser name In Param.properties file. 

  • Set testBrowser = Mozilla to run your exam In Mozilla Firefox browser.
  • Set testBrowser = Chrome to run your exam In Google Chrome browser.
  • Set testBrowser = IE to run your exam In Internet Explorer browser.
I accept modified loadWebBrowser() and closeWebBrowser() functions In SuiteBase.java file. Now  loadWebBrowser() function volition banking concern jibe the existence of previous opened browser. If whatever previous webdriver browser Instance Is be as well as then your exam volition live on executed In that Instance otherwise It volition create novel Instance.


Note : If you lot wants to run all your tests In unmarried browser Instance as well as then remove closeWebBrowser(); from @AfterTest method of all iv exam cases. Now your all tests volition run In unmarried browser Instance.

How to run WebDriver test on Mozilla Firefox Browser
  • Open Param.properties file In eclipse as well as set testBrowser=Mozilla and salve file.
  • Double click on "Run Test.bat" file from desktop to run exam suites.
Test suites volition live on executed In Mozilla Firefox browser.

How to run WebDriver test on Google Chrome Browser
  • Open Param.properties file In eclipse as well as set testBrowser=Chrome and salve file.
  • Double click on "Run Test.bat" file from desktop to run exam suites.
Test suites volition live on executed In Google Chrome browser.

How to run WebDriver exam on Internet Explorer Browser
  • Open Param.properties file In eclipse as well as set testBrowser=IE and salve file.
  • Double click on "Run Test.bat" file from desktop to run exam suites.
Test suites volition live on executed In Internet Explorer browser.

So directly you lot tin create create your exam browser from Param.properties file. You tin ready your required browser In Param.properties file as well as then all your tests volition run In that specific browser.


More interesting articles here :Generation Enggelmundus Internet Marketing Tool here :Zeageat IM http://www.software-testing-tutorials-automation.com/
Post a Comment (0)
Previous Post Next Post