簡體   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)

我在 iOS 上使用 Appium 1.4.8。 我已經使用 xcode 在模擬器中構建了代碼,並成功啟動了服務器和 Appium Inspector。 但是在運行我的代碼時,它拋出了以下錯誤。

我的能力是@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)

發生這種情況是因為前一個會話沒有正確關閉,並且在測試中拋出異常時會發生這種情況。 重新啟動appium服務器並嘗試它,它應該解決問題。

或者,如果您將appium作為節點進程啟動,則可以選擇'--session-override true' ,這樣可以避免此問題

以下是為我工作。 我正在通過連接Android設備進行測試。 請根據您的需要進行更改並申請,現在應該可以使用。

        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);

如果在appium app上,請選擇“設置”下的“ Override Existing Sessions復選框

在此輸入圖像描述

在功能中添加deviceName有幫助。 在appium日志中,我可以找出丟失的東西。

像 appium 一樣在任務管理器中殺死正在運行的服務器,基本上結束 cmd 的任務。

大家好,我在 appium 中遇到以下錯誤,請提供建議。

[RemoteTestNG] 檢測到 TestNG 版本 7.4.0 失敗配置:@BeforeTest 設置 org.openqa.selenium.SessionNotCreatedException:無法創建新的遠程會話。 請檢查服務器日志以獲取更多詳細信息。 原始錯誤:處理命令時發生未知的服務器端錯誤。 原始錯誤:無法啟動“com.apkpure.arya”應用程序。 訪問https://github.com/appium/appium/blob/master/docs/en/writing-running-appium/android/activity-startup.md進行故障排除。 原始錯誤:“com.apkpure.arya.ui.activity.SplashActivity”或“com.apkpure.arya.com.apkpure.arya.ui.activity.SplashActivity”從未啟動。 訪問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: 處理命令時發生未知的服務器端錯誤。 原始錯誤:無法啟動“com.apkpure.arya”應用程序。 訪問https://github.com/appium/appium/blob/master/docs/en/writing-running-appium/android/activity-startup.md進行故障排除。 原始錯誤:“com.apkpure.arya.ui.activity.SplashActivity”或“com.apkpure.arya.com.apkpure.arya.ui.activity.SplashActivity”從未啟動。 訪問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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM