"Session not created" error display, if try to run the same script again


#1

Device: Pixel
IDE: Eclipse
TestNG framework.

FAILED CONFIGURATION: @BeforeTest setUp
org.openqa.selenium.SessionNotCreatedException: session not created (No device with the following information was found: //device[(@serialnumber=‘ht74c0208665’) and not(@emulator=‘true’) ] Lock Device by query: @serialnumber=‘HT74C0208665’ . Device may not be available if previous session did not end properly using the quit command in such case please wait 60 [seconds] before trying to use the device again) (WARNING: The server did not provide any stacktrace information)


#2

please make sure that you are releasing the driver once the test ends

I’d recommend you to switch the configuration method (@BeforeTest) to @BeforeClass

and add the following method

@AfterClass 
public void tearDown()
{
if (driver!=null) 
     driver.quit()
}
```

#3

Thanks! it’s working…


#4

@babita92 r u sure?
it is working ?


#5

Yea its working @Rishabh_Bakshi


#6

Can any tell what is this error about

Error: System.err: org.openqa.selenium.SessionNotCreatedException: session not created (No device with the following information was found: //device[(@serialnumber=’’) and not(@emulator=‘true’) ] Lock Device by query: @serialnumber=’’ ) (WARNING: The server did not provide any stacktrace information)

Thanks in advance