WebDriver Driver is null when test complete and goes to another test | Selenium Forum
R
Roshan Karkera Posted on 25/07/2020

I am working on hybrid framework, I have placed keyword such that , once logintest is completed, another test should run like addPortfolio.

 

However, it seems that driver is showing null once logintest is completed and addPortfolio test starts (I am not calling OpenBrowser fuction during addPortfolio test, if i call openbrowser function it works fine)

Also made sure that quit fuction is not called , even i removed assertall but still driver is null after test. not sure why


A
Ashish Thakur Replied on 27/07/2020

You must have assigned different driver to each of the test 

The second test will have a different instance of the driver.

You can store driver in Itestcontext and passit if you want to share the same driver in both the tests.

Please look at testng video. In that I have show how to share stuff in Itestcontext

 


R
Roshan Karkera Replied on 01/08/2020

No, I am calling driver from basetest, however i will recheck in debug mode and come back to this.


A
Ashish Thakur Replied on 11/09/2020

Did you use driver.quit() or driver.close() methods?


Related Posts