org.openqa.selenium.WebDriverException:会话未启动或终止(警告:服务器未提供任何堆栈跟踪信息)命令持续时间或超时:0毫秒构建信息:版本:'3.141.59',修订:'e82be7d358',时间:'2018-11-14T08:17:03‘系统信息:主机:'LAPTOP-AI87CII4',ip:'192.168.43.101',os.name:'Windows 10',os.arch:'amd64',os.version:'10.0',java.version:'1.8.0_261‘驱动程序信息: io.appium.java_client.android.AndroidDriver功能{64bit: false,acceptSslCert: false,acceptSslCerts: false,adbExecTimeout: 120000,appActivity: biz.tikme.activities.Splash...,appPackage: biz.tikme,autoGrantPermissions: true,automationName: uiautomator2,browserstack.is_hub_canary: false,browserstack.minOSVersion: 4.4,bundleID: biz.tikme,bundleId: biz.tikme,:{:false},:true,detected_language: selenium/3.141.59 (java win...,设备:谷歌像素3,deviceName:安卓,enablePerformanceLogging: false,javascriptEnabled: true,手机:{browser: mobile,version: Google Pixel 3-9.0},nativeWebScreenshot: true,newCommandTimeout: 0,new_bucketing: true,noReset: false,orientation: PORTRAIT,orig_os: Android,osVersion: 9.0,os_version: 9.0,platform: ANDROID,platformName: Android,projectName: TikMe-HyperLocalAutomationP...,realMobile: true,systemPort: 8201,udid: 88MX01NAS,uiautomator2ServerLaunchTimeout: 6000000,版本:}会话ID: 44f96cd0f831bf10a228bfa2c6a46876d1278e15 at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native方法) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:423) at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:214) at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:166) at org.openqa.selenium.remote.http.JsonHttpResponseCodec.reconstructValue(org.openqa.selenium.remote.http.AbstractHttpResponseCodec.decode(AbstractHttpResponseCodec.java:80) at org.openqa.selenium.remote.http.AbstractHttpResponseCodec.decode(AbstractHttpResponseCodec.java:44) at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:158) at io.appium.java_client.remote.AppiumCommandExecutor.execute(AppiumCommandExecutor.java:239) at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:552) at io.appium.java_client.DefaultGenericMobileDriver.execute(的JsonHttpResponseCodec.java:40)io.appium.java_client.AppiumDriver.execute(AppiumDriver.java:1) at io.appium.java_client.android.AndroidDriver.execute(AndroidDriver.java:1) at io.appium.java_client.InteractsWithApps.closeApp(InteractsWithApps.java:140) at com.tikme.hyperlocal.mobileautomation.base.Base.closeapp(Base.java:98) at com.tikme.hyperlocal.mobileautomation.step.Hooks.quit(Hooks.java:82)的DefaultGenericMobileDriver.java:45)
``` *** if(new GlobalParams().getmedium().equals("BrowserStack")) { int i = 0; while(i<3) { try { Thread.sleep(2000); new TestUtils().log().info("going to reset the app"); manager.getDriver().resetApp(); // This is the method which throws the exception new TestUtils().log().info("app is resetted successfully"); break; } catch(Exception e) { new TestUtils().log().fatal("tried"+" "+i+" "+"time to reset the app but failed."); i++; } } } new Base().closeapp(); }} ```发布于 2020-09-15 03:51:30
如果resetApp()不起作用,您可以尝试将其添加为DesiredCapabilities对象的功能
DesiredCapabilities capabilities = DesiredCapabilities.android();
capabilities.setCapability(MobileCapabilityType.NO_RESET, false);
capabilities.setCapability(MobileCapabilityType.FULL_RESET, true);这两行将重置您的应用程序,这是文档http://appium.io/docs/en/writing-running-appium/other/reset-strategies/#reset-strategies
https://stackoverflow.com/questions/63888645
复制相似问题