简体   繁体   English

org.openqa.selenium.SessionNotCreatedException:无法创建新会话。 (原始错误:请求了一个新会话,但正在进行中)

[英]org.openqa.selenium.SessionNotCreatedException: A new session could not be created. (Original error: Requested a new session but one was in progress)

I am using Appium 1.4.8 for iOS .我在 iOS 上使用 Appium 1.4.8。 I have build the code in simulator using xcode and successfully able to launch the server as well as Appium Inspector.我已经使用 xcode 在模拟器中构建了代码,并成功启动了服务器和 Appium Inspector。 But while running my code it is throwing the below error.但是在运行我的代码时,它抛出了以下错误。

My capabilities are @BeforeMethod public void setUp() throws MalformedURLException{我的能力是@BeforeMethod public void setUp() throws MalformedURLException{

DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability("appium-version", "1.0");
capabilities.setCapability("platformName", "iOS");
capabilities.setCapability("platformVersion", "8.4");
capabilities.setCapability("deviceName", "iPad 2");
capabilities.setCapability("app", "/Users/arunhs/Desktop/AppiumReq/SRC/build/Debug-iphonesimulator/ComplianceWire.app");
driver = new AppiumDriver(new URL("http://127.0.0.1:4723/wd/hub"), capabilities);
driver.manage().timeouts().implicitlyWait(60, TimeUnit.SECONDS);

} }

Error is: 
FAILED CONFIGURATION: @BeforeMethod setUp
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)
Command duration or timeout: 447 milliseconds
Build info: version: '2.47.1', revision: '411b314', time: '2015-07-30 03:03:16'
System info: host: 'N/A', ip: 'N/A', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.10.4', java.version: '1.7.0_79'
Driver info: io.appium.java_client.AppiumDriver
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:206)
at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:158)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:595)
at io.appium.java_client.AppiumDriver.execute(AppiumDriver.java:88)
at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:242)
at org.openqa.selenium.remote.RemoteWebDriver.(RemoteWebDriver.java:128)
at org.openqa.selenium.remote.RemoteWebDriver.(RemoteWebDriver.java:155)
at io.appium.java_client.AppiumDriver.(AppiumDriver.java:44)
at com.selenium.test.DriverScript.setUp(DriverScript.java:68)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:85)
at org.testng.internal.Invoker.invokeConfigurationMethod(Invoker.java:515)
at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:213)
at org.testng.internal.Invoker.invokeMethod(Invoker.java:590)
at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:834)
at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1142)
at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:124)
at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:108)
at org.testng.TestRunner.privateRun(TestRunner.java:771)
at org.testng.TestRunner.run(TestRunner.java:621)
at org.testng.SuiteRunner.runTest(SuiteRunner.java:357)
at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:352)
at org.testng.SuiteRunner.privateRun(SuiteRunner.java:310)
at org.testng.SuiteRunner.run(SuiteRunner.java:259)
at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
at org.testng.TestNG.runSuitesSequentially(TestNG.java:1176)
at org.testng.TestNG.runSuitesLocally(TestNG.java:1101)
at org.testng.TestNG.run(TestNG.java:1009)
at org.testng.remote.RemoteTestNG.run(RemoteTestNG.java:111)
at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:204)
at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:175)

This happens because the previous session wasn't shutdown properly and it happens when there is exception thrown in your test. 发生这种情况是因为前一个会话没有正确关闭,并且在测试中抛出异常时会发生这种情况。 Restart the appium server and try it , it should resolve the issue. 重新启动appium服务器并尝试它,它应该解决问题。

Alternatively if you starting appium as node process, you can give option '--session-override true' and this would avoid this problem 或者,如果您将appium作为节点进程启动,则可以选择'--session-override true' ,这样可以避免此问题

The following is working for me. 以下是为我工作。 I am testing by connecting Android device. 我正在通过连接Android设备进行测试。 Please make changes as per your need and apply, this should work now. 请根据您的需要进行更改并申请,现在应该可以使用。

        DesiredCapabilities capabilities = new DesiredCapabilities().android();
        capabilities.setCapability("no",true);
        capabilities.setCapability("newCommandTimeout", 100000);
        capabilities.setCapability("noReset", true);
        capabilities.setCapability(CapabilityType.BROWSER_NAME, "");
        capabilities.setCapability(CapabilityType.VERSION, "4.4.2");
        capabilities.setCapability("deviceName", "Galaxy nexus");
        capabilities.setCapability("app", application.getAbsolutePath());
        capabilities.setCapability("automationName", "selendroid");
        capabilities.setCapability("noRest", true);
        driver = new AndroidDriver<MobileElement>(new URL("http://127.0.0.1:4723/wd/hub"), capabilities);

If on appium app then select Override Existing Sessions checkbox under Settings - 如果在appium app上,请选择“设置”下的“ Override Existing Sessions复选框

在此输入图像描述

Adding the deviceName in the capabilities helped. 在功能中添加deviceName有帮助。 In the appium logs I could figure out the missing thing. 在appium日志中,我可以找出丢失的东西。

像 appium 一样在任务管理器中杀死正在运行的服务器,基本上结束 cmd 的任务。

Hi all I am getting below error in appium please advice.大家好,我在 appium 中遇到以下错误,请提供建议。

[RemoteTestNG] detected TestNG version 7.4.0 FAILED CONFIGURATION: @BeforeTest setup org.openqa.selenium.SessionNotCreatedException: Unable to create a new remote session. [RemoteTestNG] 检测到 TestNG 版本 7.4.0 失败配置:@BeforeTest 设置 org.openqa.selenium.SessionNotCreatedException:无法创建新的远程会话。 Please check the server log for more details.请检查服务器日志以获取更多详细信息。 Original error: An unknown server-side error occurred while processing the command.原始错误:处理命令时发生未知的服务器端错误。 Original error: Cannot start the 'com.apkpure.arya' application.原始错误:无法启动“com.apkpure.arya”应用程序。 Visit https://github.com/appium/appium/blob/master/docs/en/writing-running-appium/android/activity-startup.md for troubleshooting.访问https://github.com/appium/appium/blob/master/docs/en/writing-running-appium/android/activity-startup.md进行故障排除。 Original error: 'com.apkpure.arya.ui.activity.SplashActivity' or 'com.apkpure.arya.com.apkpure.arya.ui.activity.SplashActivity' never started.原始错误:“com.apkpure.arya.ui.activity.SplashActivity”或“com.apkpure.arya.com.apkpure.arya.ui.activity.SplashActivity”从未启动。 Visit https://github.com/appium/appium/blob/master/docs/en/writing-running-appium/android/activity-startup.md for troubleshooting Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:17:03' System info: host: 'DESKTOP-62KVR75', ip: '192.168.11.116', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '17' Driver info: driver.version: AndroidDriver remote stacktrace: UnknownError: An unknown server-side error occurred while processing the command.访问https://github.com/appium/appium/blob/master/docs/en/writing-running-appium/android/activity-startup.md进行故障排除 构建信息:版本:'3.141.59',修订:' e82be7d358',时间:'2018-11-14T08:17:03' 系统信息:主机:'DESKTOP-62KVR75',ip:'192.168.11.116',os.name:'Windows 10',os.arch:'amd66 ', os.version: '10.0', java.version: '17' Driver info: driver.version: AndroidDriver remote stacktrace: UnknownError: 处理命令时发生未知的服务器端错误。 Original error: Cannot start the 'com.apkpure.arya' application.原始错误:无法启动“com.apkpure.arya”应用程序。 Visit https://github.com/appium/appium/blob/master/docs/en/writing-running-appium/android/activity-startup.md for troubleshooting.访问https://github.com/appium/appium/blob/master/docs/en/writing-running-appium/android/activity-startup.md进行故障排除。 Original error: 'com.apkpure.arya.ui.activity.SplashActivity' or 'com.apkpure.arya.com.apkpure.arya.ui.activity.SplashActivity' never started.原始错误:“com.apkpure.arya.ui.activity.SplashActivity”或“com.apkpure.arya.com.apkpure.arya.ui.activity.SplashActivity”从未启动。 Visit https://github.com/appium/appium/blob/master/docs/en/writing-running-appium/android/activity-startup.md for troubleshooting at getResponseForW3CError (C:\\Users\\HashStudioz\\Downloads\\Appium-Server-GUI-windows-1.22.0\\resources\\app\\node_modules\\appium\\node_modules\\appium-base-driver\\lib\\protocol\\errors.js:804:9) at asyncHandler (C:\\Users\\HashStudioz\\Downloads\\Appium-Server-GUI-windows-1.22.0\\resources\\app\\node_modules\\appium\\node_modules\\appium-base-driver\\lib\\protocol\\protocol.js:380:37) Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:17:03' System info: host: 'DESKTOP-62KVR75', ip: '192.168.11.116', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '访问https://github.com/appium/appium/blob/master/docs/en/writing-running-appium/android/activity-startup.md在 getResponseForW3CError (C:\\Users\\HashStudioz\\Downloads\\Appium- Server-GUI-windows-1.22.0\\resources\\app\\node_modules\\appium\\node_modules\\appium-base-driver\\lib\\protocol\\errors.js:804:9) 在 asyncHandler (C:\\Users\\HashStudioz\\Downloads\\ Appium-Server-GUI-windows-1.22.0\\resources\\app\\node_modules\\appium\\node_modules\\appium-base-driver\\lib\\protocol\\protocol.js:380:37) 构建信息:版本:'3.141.59' , 修订版:'e82be7d358',时间:'2018-11-14T08:17:03' 系统信息:主机:'DESKTOP-62KVR75',ip:'192.168.11.116',os.name:'Windows 10',os.拱:'amd64',os.version:'10.0',java.version:'

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 org.openqa.selenium.SessionNotCreatedException:无法创建新的会话。 (原始错误:&#39;java -version&#39;失败。错误:产生ENOENT) - org.openqa.selenium.SessionNotCreatedException: A new session could not be created. (Original error: 'java -version' failed. Error: spawn ENOENT) org.openqa.selenium.SessionNotCreatedException:无法启动新的 session。 使用驱动程序 service-docker 容器创建 session 时出错 - org.openqa.selenium.SessionNotCreatedException: Could not start a new session. Error while creating session with the driver service-docker container org.openqa.selenium.SessionNotCreatedException:消息:无法启动新的 session。响应代码 500 错误使用 Selenium Java - org.openqa.selenium.SessionNotCreatedException: Message: Could not start a new session. Response code 500 error using Selenium Java Appium 错误:线程“main”org.openqa.selenium.SessionNotCreatedException 中的异常:无法创建新的远程会话 - Appium Error :Exception in thread "main" org.openqa.selenium.SessionNotCreatedException: Unable to create a new remote session org.openqa.selenium.SessionNotCreatedException:会话未为Chrome创建异常 - org.openqa.selenium.SessionNotCreatedException: session not created exception for Chrome Selenium(OSX 和 Linux)抛出错误 org.openqa.selenium.SessionNotCreatedException:会话未创建:找不到匹配的功能 - Selenium(OSX and Linux) thowing error org.openqa.selenium.SessionNotCreatedException: session not created: No matching capabilities found Selenium 3.0 Firefx 驱动程序因 org.openqa.selenium.SessionNotCreatedException 失败:无法创建新的远程会话 - Selenium 3.0 Firefx Driver fails with org.openqa.selenium.SessionNotCreatedException: Unable to create new remote session WinAppDriver:org.openqa.selenium.SessionNotCreatedException:无法创建新的远程 session - WinAppDriver: org.openqa.selenium.SessionNotCreatedException: Unable to create a new remote session org.openqa.selenium.SessionNotCreatedException:无法启动新的 session.响应码 500.Message:未知错误:无法创建 Chrome 进程 - org.openqa.selenium.SessionNotCreatedException:Could not start a new session.Response code 500.Message:unknown error: Failed to create Chrome process org.openqa.selenium.SessionNotCreatedException:会话未创建断开连接:无法使用 ChromeDriver 和 Chrome 将消息发送到渲染器错误 - org.openqa.selenium.SessionNotCreatedException: session not created disconnected:unable to send message to renderer error with ChromeDriver and Chrome
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM