is there a way to use the same webdriver object for multiple java classes when running within a testng suite?
Put all your classes in a <test>
tag and initialize the driver in a @BeforeTest
method which you store in the base class so that all your test methods can access it.
Manpreet Singh
Updated on June 04, 2022Comments
-
Manpreet Singh almost 2 years
is there a way to use the same webdriver object for multiple tests/classes when run within a testng suite? What I mean is to start the WebDriver instance with one class, but continue using it over subsequent classes/tests in the suite?
The problem I am facing is that 10 differect classes have this statement:
WebDriver driver = new FirefoxDriver();
and it open 10 different instances even after I restrict TestNG with parallel mode set a s false. It really sucks up my system memory.
I wat a solution to use same WebDriver and run different classes over without having to multiple browser and Webdriver insntances.