Java 获取异常:selenium.NoSuchSessionException:会话ID为null。这里我使用了Localthread<;webdriver>;用于并行执行

Java 获取异常:selenium.NoSuchSessionException:会话ID为null。这里我使用了Localthread<;webdriver>;用于并行执行,java,selenium,webdriver,Java,Selenium,Webdriver,**获得以下异常: org.openqa.selenium.NoSuchSessionException:会话ID为空。调用quit()后使用WebDriver?在这里,我使用LocalThread进行并行测试执行,但在一个线程中运行类内的多个测试时(不是并行执行) 第一个测试用例成功运行,第二个和第三个测试用例失败** 控制台输出: [TestNG]正在运行: C:\Users\Afsar\AppData\Local\Temp\testngeclipse--442788521\testng-

**获得以下异常: org.openqa.selenium.NoSuchSessionException:会话ID为空。调用quit()后使用WebDriver?在这里,我使用LocalThread进行并行测试执行,但在一个线程中运行类内的多个测试时(不是并行执行) 第一个测试用例成功运行,第二个和第三个测试用例失败**

控制台输出:
[TestNG]正在运行:
C:\Users\Afsar\AppData\Local\Temp\testngeclipse--442788521\testng-customsuite.xml
******在Before方法init方法中*********
已创建驱动程序实例并设置当前本地线程
在端口41879上启动ChromeDriver 2.33.506120(E3E534376286C0BC2D2DC9AA4915BA81D9023F)
只允许本地连接。
log4j:WARN找不到记录器(org.apache.http.client.protocol.RequestAddCookies)的追加器。
log4j:警告请正确初始化log4j系统。
log4j:请参阅http://logging.apache.org/log4j/1.2/faq.html#noconfig 更多信息。
2017年10月22日下午5:03:12 org.openqa.selenium.remote.ProtocolHandshake createSession
信息:检测到的方言:OSS
设置当前线程方法被调用。。
已调用Get-curent线程方法。。
当前线程id:1线程名称为:main
已调用Get-curent线程方法。。
当前线程id:1线程名称为:main
已调用Get-curent线程方法。。
当前线程id:1线程名称为:main
*********运行第一个测试用例*********
已调用Get-curent线程方法。。
当前线程id:1线程名称为:main
已调用Get-curent线程方法。。
当前线程id:1线程名称为:main
****执行登录操作*********
URL已成功发送。。
点击登录按钮
输入的用户名
输入的密码
已单击登录
******执行寄存器操作*********
已调用Get-curent线程方法。。
当前线程id:1线程名称为:main
找到“注册”按钮
通过:第一个测试用例:登录成功。。
******在后拆法中*********
从当前线程中删除驱动程序实例并关闭所有sesion
司机:很好
******在Before方法init方法中*********
已创建驱动程序实例并设置当前本地线程
在端口47720上启动ChromeDriver 2.33.506120(E3E534376286C0BC2D2DC9AA4915BA81D9023F)
只允许本地连接。
2017年10月22日下午5:03:39 org.openqa.selenium.remote.ProtocolHandshake createSession
信息:检测到的方言:OSS
设置当前线程方法被调用。。
已调用Get-curent线程方法。。
当前线程id:1线程名称为:main
已调用Get-curent线程方法。。
当前线程id:1线程名称为:main
已调用Get-curent线程方法。。
当前线程id:1线程名称为:main
*********运行第二个测试用例*********
****执行登录操作*********
URL已成功发送。。
******在后拆法中*********
从当前线程中删除驱动程序实例并关闭所有sesion
司机:很好
******在Before方法init方法中*********
已创建驱动程序实例并设置当前本地线程
在端口25049上启动ChromeDriver 2.33.506120(E3E534376286C0BC2D2DC9AA4915BA81D9023F)
只允许本地连接。
2017年10月22日下午5:03:45 org.openqa.selenium.remote.ProtocolHandshake createSession
信息:检测到的方言:OSS
设置当前线程方法被调用。。
已调用Get-curent线程方法。。
当前线程id:1线程名称为:main
已调用Get-curent线程方法。。
当前线程id:1线程名称为:main
已调用Get-curent线程方法。。
当前线程id:1线程名称为:main
*********运行第三个测试用例*********
****执行登录操作*********
URL已成功发送。。
******在后拆法中*********
从当前线程中删除驱动程序实例并关闭所有sesion
司机:很好
已删除当前线程,并调用了clearcurrentDriver()。。
通过:逻辑功能
这是第一次测试,与第一次测试相同
失败:LoginFunctionality1
这是和第一次相同的第二次测试
org.openqa.selenium.NoSuchSessionException:会话ID为空。调用quit()后使用WebDriver?
构建信息:版本:“3.6.0”,修订版:“6fbf3ec767”,时间:“2017-09-27T15:28:36.4Z”
系统信息:主机:'AFSAR-PC',ip:'192.168.0.100',os.name:'Windows 7',os.arch:'amd64',os.version:'6.1',java.version:'1.8.0131'
驱动程序信息:Driver.version:RemoteWebDriver
位于org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:131)
位于org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:83)
位于org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:586)
位于org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:356)
位于org.openqa.selenium.remote.RemoteWebDriver.findElementByLinkText(RemoteWebDriver.java:410)
位于org.openqa.selenium.By$ByLinkText.findElement(By.java:246)
位于org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:348)
位于org.openqa.selenium.support.pagefactory.DefaultElementLocator.findElement(DefaultElementLocator.java:69)
位于org.openqa.selenium.support.pagefactory.internal.LocatingElementHandler.invoke(LocatingElementHandler.java:38)
在com.sun.proxy.$Proxy9.单击(未知源)
在com.afsar.framework.pageobjects.MercuryToursHomePage.clickRegister(MercuryToursHomePage.java:58)上
位于com.afsar.framework.actions.MercuryHomePage_Action.Login_Action(MercuryHomePage_Action.java:13)
位于com.afsar.framework.tests.LoginTest.LoginFunctionality1(LoginTest.java:56)
在sun.reflect.NativeMethodAccessorImpl.invoke0(本机方法)处
位于sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
在sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)中
位于java.lang.reflect.Method.invoke(Method.java:498)
位于org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:80)
在org.testng.i
@AfterMethod
public void teardown(){         
    System.out.println("****** In After Method tear down *********");
    System.out.println("Removing driver instance from current thread and closing all sesions");
    //Driver.getCurrentDriver().quit();         
}

@AfterTest
    public void aftertest(){
    Driver.QuitDriver();
}