我试图在同一个程序中重复使用相同的驱动程序2次。 我想这样做,所以我可以在多个浏览器上运行相同的测试。
driver = new FirefoxDriver();
driver.manage().window().maximize();
test();
closeDriver();
System.setProperty("webdriver.chrome.driver", "C:/eclipse/chrome/chromedriver.exe");
ChromeOptions options = new ChromeOptions();
options.addArguments("--start-maximized");
driver = new ChromeDriver(options);
test();
closeDriver();
org.openqa.selenium.remote.SessionNotFoundException:没有这样的会话 (驱动程序信息:chromedriver = 2.9.248315,platform = Windows NT 6.1 SP1 x86_64)(警告:服务器未提供任何堆栈跟踪信息)
命令持续时间或超时:113毫秒
构建信息:版本:' 2.43.0',修订版:' 597b76b',时间:' 2014-09-09 20:52:38' 系统信息:主机:' HPATE-E5420',ip:' 10.16.70.161',os.name:' Windows 7',os.arch:&# 39; amd64',os.version:' 6.1',java.version:' 1.7.0_67'
会议ID:d38ea9501aa738784e2aa3f7ad9edced
驾驶员信息:org.openqa.selenium.chrome.ChromeDriver
功能[{platform = XP,acceptSslCerts = true,javascriptEnabled = true,browserName = chrome,chrome = {userDataDir = C:\ Users \ hpate \ AppData \ Local \ Temp \ scoped_dir6692_16996},rotate = false,locationContextEnabled = true,version = 37.0.2062.120,takesHeapSnapshot = true,cssSelectorsEnabled = true,databaseEnabled = false,handlesAlerts = true,browserConnectionEnabled = false,nativeEvents = true,webStorageEnabled = true,applicationCacheEnabled = false,takesScreenshot = true}]
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
在org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:204)
at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:162)
在org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:599)
在org.openqa.selenium.remote.RemoteWebDriver.get(RemoteWebDriver.java:304)
在jUnitTestCases.VerifyRole.test(VerifyRole.java:66)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
在java.lang.reflect.Method.invoke(未知来源)
在org.junit.runners.model.FrameworkMethod $ 1.runReflectiveCall(FrameworkMethod.java:47)
在org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
在org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
在org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
在org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
在org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
在org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271)
在org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70)
在org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
在org.junit.runners.ParentRunner $ 3.run(ParentRunner.java:238)
在org.junit.runners.ParentRunner $ 1.schedule(ParentRunner.java:63)
在org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
在org.junit.runners.ParentRunner.access $ 000(ParentRunner.java:53)
在org.junit.runners.ParentRunner $ 2.evaluate(ParentRunner.java:229)
在org.junit.runners.ParentRunner.run(ParentRunner.java:309)
在org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
在org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
在org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459)
在org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675)
在org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
在org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)