RE: Can we use objects of one class in another class only with the help of TestNG?
Can we use objects of one class in another class only with the help of TestNG?
e.g.: I have an object of a driver and sheet in class 1 and I want to use them in class2. How we can do it having TestNG implemented?
Or you may suggest a solution that can be implemented.
Returned the driver object from method of Class 1
and called that in Class 2 as
public void conversation() throws IOException, InterruptedException
WebDriver driver = Class_1.atStart();
But there is an error and the methods in class 2 fails.
The error message is
“org.openqa.selenium.SessionNotCreatedException: A new session could not be created. (Original error: Requested a new session but one was in progress) (WARNING: The server did not provide any stacktrace information)”
I understand that driver is trying to create a new session when one is already up.
Do not know what can be done betterly to continue the same session.
Can you please help?
Thanks in Advance!