I am automating an application using selenium webdriver with java. In that i have to open a browser instance & perform some actions. After that i have to open another browser instance, perform some actions in it & close that instance. Then i have to return the control back to the first browser instance again to perform some other actions.
I tried using :
String winHandleBefore = driver.getWindowHandle(); //then open new instance and perfom the actions driver.switchTo().window(winHandleBefore); But this returned an error :
org.openqa.selenium.remote.SessionNotFoundException: no such session
How can i do this? Can anybody help?