Test Framework For Selenium WebDriver : Implement Load Browser Function

As yous know, We accept already Introduced Selenium webdriver In our exam information driven framework during PREVIOUS POST. And directly nosotros are going ahead real slow to exercise information driven framework In selenium webdriver tests.
STEP 23


Prerequisite : All previous information driven framework creation steps for selenium webdriver should travel Implemented. You volition larn links for all steps at THIS PAGE.

Why Need To Centralize Load Browser Function
If yous accept looked Inside all iv exam cases, All iv exam cases accept a same code to opened upwards browser, to maximize browser in addition to to laid timeout. Right now, We accept solely 4 exam cases In our framework but supposing yous accept 100 exam cases In your existent Blue Planet projection thus yous volition repeat same code In all 100 exam cases? This Is non skilful coding practice.. Right..? By centralizing charge browser function, We volition larn bellow given ii benefits.
  • Using centralized charge browser, We tin eliminate duplicate code In all exam cases. So It volition trim down code size.
  • In future, If yous wants to alter whatsoever matter In opened upwards browser function, You tin do It easily from 1 place. Supposing yous wants to alter timeout from fifteen seconds to xx seconds thus yous accept to modify code at solely 1 house in addition to It volition travel applied everywhere.
How To Do It?
We volition do 1 mutual function loadWebBrowser() In SuiteBase.java file in addition to thus volition telephone phone It In all exam cases.

What loadWebBrowser() Will Do?
loadWebBrowser() function volition travel useful to get bellow given things.
  • To opened upwards the novel browser Instance.
  • To maximize browser.
  • To apply Implicit hold off for test.
In Next step, We volition too Implement functionality to run your tests In other browsers similar Google chrome in addition to Internet Explorer in addition to how to larn by It from 1 place.

I accept too Implemented closeWebBrowser() constituent in addition to used It Inside @AfterTest method of all exam cases to unopen browser later exam illustration execution.

Download Required Files
I accept modified all exam cases in addition to SuiteBase.java files to Implement loadWebBrowser() and  closeWebBrowser() functions. You volition larn all files past times downloading bellow given aught folder.
Extract the folder in addition to copy-paste all files on respective packages of "WDDF" projection to supervene upon existing files.

Run Test And Observe Result
Double click on "Shortcut to Run Test.bat" file to run test. Observe exam execution in addition to results.


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