Module 21 | Selenium Forum
M
Posted on 19/06/2016
In PortFolioTest.java, there are 3 tests (createPortFolioTest, renamePortFolioTest, deletePortFolioTest)

I last video 28 it is mentioned that all the tests share the same session, suppose if we use "CloseBrowser" in createPortFolioTest, then renamePortFolioTest does not runs and automatically fails. i.e When we call "closeBrowser" method , driver is set to null.


But when renamePortFolioTest runs, it checks and creates a driver for it right as below? and test should run normal right?

Kewords.java
--------------
if(map.get(browserType.toLowerCase()) == null){

if(browserType.equalsIgnoreCase(Constants.MOZILLA))
driver = new FirefoxDriver();
else if(browserType.equalsIgnoreCase(Constants.CHROME)){
System.setProperty("webdriver.chrome.driver",prop.getProperty("chromedriverexe") );
driver = new ChromeDriver();
}
map.put(browserType.toLowerCase(), driver);
}
else{ // flag
driver= map.get(browserType.toLowerCase());
}

M
Replied on 20/06/2016

[quote:1oetjxsu]When we call "closeBrowser" method , driver is set to null.
[/quote:1oetjxsu]

closeBrowser ends the webdriver session. so, yes it is set to null.


M
Replied on 20/06/2016

Again if we call driver instance is created right


M
Replied on 20/06/2016

yeah if you call again it will be created.