Prerequisite : All previous selenium data driven framework creation steps should be Implemented. All previous steps link are given on THIS PAGE.
Download Required Files
You need total 4 files for this step.
- SuiteBase.java
- Param.properties
- chromedriver.exe
- IEDriverServer.exe
To run your test In Google Chrome or Internet Explorer browser, You have to download Chrome driver “chromedriver.exe” and Internet Explorer Driver “IEDriverServer.exe” files. You can download both .exe files from THIS PAGE In zipped format.
You can get latest version of “chromedriver.exe” file from THIS PAGE and “IEDriverServer.exe” from THIS PAGE too.
You need modified SuiteBase.java file, and need to add newly created Param.properties file to run your test on Chrome or Firefox or Internet Explorer browser. You will get both files by downloading bellow given zip folder.
- Paste SuiteBase.java file on com.stta.TestSuiteBase Package.
- Paste Param.properties file on com.stta.property Package.
- Create new folder with name = “BrowserDrivers” under your project and put “chromedriver.exe” and “IEDriverServer.exe” Inside It.
Now you can run your webdriver test on your required browser. Only you have to change testBrowser name In Param.properties file.
- Set testBrowser = Mozilla to run your test In Mozilla Firefox browser.
- Set testBrowser = Chrome to run your test In Google Chrome browser.
- Set testBrowser = IE to run your test In Internet Explorer browser.
I have modified loadWebBrowser() and closeWebBrowser() functions In SuiteBase.java file. Now loadWebBrowser() function will check the existence of previous opened browser. If any previous webdriver browser Instance Is exist then your test will be executed In that Instance otherwise It will create new Instance.
How to run WebDriver test on Mozilla Firefox Browser
- Open Param.properties file In eclipse and set testBrowser=Mozilla and save file.
- Double click on “Run Test.bat” file from desktop to run test suites.
How to run WebDriver test on Google Chrome Browser
- Open Param.properties file In eclipse and set testBrowser=Chrome and save file.
- Double click on “Run Test.bat” file from desktop to run test suites.
How to run WebDriver test on Internet Explorer Browser
- Open Param.properties file In eclipse and set testBrowser=IE and save file.
- Double click on “Run Test.bat” file from desktop to run test suites.
So now you can manage your test browser from Param.properties file. You can set your required browser In Param.properties file then all your tests will run In that specific browser.
3 thoughts on “Selenium Data Driven Framework : Running Test In Different Browsers”
I kept,
testBrowser=IE
testBrowser=Mozilla
testBrowser=Chrome , 3 browsers in param.properties but test cases are executing only in chrome browser
I Kept
testBrowser=ie in param.properties but test cases are excuting only in firefox…
Hi,
For Me Test cases are not executed in any of the browser. Can you help me out