Getting Exception : io.appium.java_client.NoSuchContextException even though web view context exists

0

Tests run absolutely fine on local but fails on AWS Device Farm IOS Error Log:

2023-07-24 17:30:43 [main] INFO  — [IS_PRESENT] {ASINS_IN_MANUAL_CAROUSEL} 121ms Value: 'true'
2023-07-24 17:30:43 [main] INFO  — [CLICK] {ASINS_IN_MANUAL_CAROUSEL} 246ms Value: 'true'
2023-07-24 17:30:43 [main] DEBUG — Available Contexts for Appium are [NATIVE_APP, WEBVIEW_360.2, WEBVIEW_360.81, WEBVIEW_360.87]
2023-07-24 17:30:44 [main] INFO  — Switched context to amazon by type PARTIAL_URL
2023-07-24 17:30:44 [main] DEBUG — Available Contexts for Appium are [NATIVE_APP, WEBVIEW_360.2, WEBVIEW_360.81, WEBVIEW_360.87]
2023-07-24 17:30:47 [main] INFO  — Switched context to /gp/product by type PARTIAL_URL
2023-07-24 17:30:48 [main] INFO  — waiting 20 seconds (max) for element: 'BACK_TO_BROWSE_PAGE'
2023-07-24 17:30:55 [main] INFO  — [WAIT_TO_BE_ENABLED] {BACK_TO_BROWSE_PAGE} 7621ms Value: 'true'
2023-07-24 17:31:07 [main] INFO  — [CLICK] {BACK_TO_BROWSE_PAGE} 5944ms Value: 'true'
2023-07-24 17:31:07 [main] DEBUG — Available Contexts for Appium are [NATIVE_APP, WEBVIEW_360.2, WEBVIEW_360.87]
2023-07-24 17:31:07 [main] INFO  — Switched context to amazon by type PARTIAL_URL
2023-07-24 17:31:07 [main] DEBUG — Available Contexts for Appium are [NATIVE_APP, WEBVIEW_360.2, WEBVIEW_360.87]
2023-07-24 17:31:07 [main] INFO  — Switched context to /fmc/everyday-essentials by type PARTIAL_URL
2023-07-24 17:31:08 [main] INFO  — [GET_VALUE] {ASINS_IN_MANUAL_CAROUSEL} 466ms Value: 'https://www.amazon.com/Downy-Infusions-Lavender-Serenity-105/dp/B008UQVA9G?_encoding=UTF8&fpw=new&fpl=fresh&ref_=ee_marquee_m_m_sf_2_19_i&pf_rd_p=ec38d946-68ac-4c31-a4e1-f9ec4018728b&pf_rd_r=PXDNXA5DQTN8PA9GY0P4'
2023-07-24 17:31:08 [main] INFO  — [IS_PRESENT] {ASINS_IN_MANUAL_CAROUSEL} 104ms Value: 'false'
2023-07-24 17:31:12 [main] INFO  — [CLICK] {ASINS_IN_MANUAL_CAROUSEL} 139ms Value: 'true'
2023-07-24 17:31:12 [main] DEBUG — Available Contexts for Appium are [NATIVE_APP, WEBVIEW_360.2, WEBVIEW_360.87]
2023-07-24 17:31:12 [main] INFO  — Switched context to amazon by type PARTIAL_URL
2023-07-24 17:31:12 [main] DEBUG — Available Contexts for Appium are [NATIVE_APP, WEBVIEW_360.2, WEBVIEW_360.87, WEBVIEW_360.92]
2023-07-24 17:31:13 [main] DEBUG — Available Contexts for Appium are [NATIVE_APP, WEBVIEW_360.2, WEBVIEW_360.87, WEBVIEW_360.92]
2023-07-24 17:31:13 [main] DEBUG — Available Contexts for Appium are [NATIVE_APP, WEBVIEW_360.2, WEBVIEW_360.87, WEBVIEW_360.92]
2023-07-24 17:31:14 [main] DEBUG — Available Contexts for Appium are [NATIVE_APP, WEBVIEW_360.2, WEBVIEW_360.87, WEBVIEW_360.92]
2023-07-24 17:31:15 [main] DEBUG — Available Contexts for Appium are [NATIVE_APP, WEBVIEW_360.2, WEBVIEW_360.87, WEBVIEW_360.92]
2023-07-24 17:31:15 [main] ERROR — Test Failed [class: com.amazon.leep.nativeapp.tests.EEMarqueeTests.EEMarqueeIOS, method: verifyATCOnManualCarousel]
!!! Exception was io.appium.java_client.NoSuchContextException: An unknown server-side error occurred while processing the command. Original error: Missing target for given targetId
Build info: version: 'unknown', revision: 'unknown', time: 'unknown'
System info: host: 'ip-192-168-10-5.us-west-2.compute.internal', ip: 'fe80:0:0:0:c40:d01f:e7e7:3f0c%en0', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.16', java.version: '12.0.2'
Driver info: io.appium.java_client.ios.IOSDriver
Capabilities {additionalWebviewBundleIds: [com.amazon.Amazon.development], app: /tmp/scratchaCRY1Q.scratch/..., appName: Amazon.app.ipa, autoWebview: false, automationName: XCUITest, browserName: , bundleId: com.amazon.AmazonUK.Enterprise, databaseEnabled: false, derivedDataPath: /tmp/scratchaCRY1Q.scratch/..., deviceName: 00008101-001268642669001E, javascriptEnabled: true, locationContextEnabled: false, networkConnectionEnabled: false, newCommandTimeout: 10000, platform: MAC, platformName: iOS, takesScreenshot: true, udid: 00008101001268642669001E, useFirstMatch: true, usePrebuiltWDA: true, waitForQuiescence: false, webStorageEnabled: false}
Session ID: a9814d39-d1dd-4b22-b0c8-07b2ee356aaa
io.appium.java_client.NoSuchContextException: An unknown server-side error occurred while processing the command. Original error: Missing target for given targetId
Build info: version: 'unknown', revision: 'unknown', time: 'unknown'
System info: host: 'ip-192-168-10-5.us-west-2.compute.internal', ip: 'fe80:0:0:0:c40:d01f:e7e7:3f0c%en0', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.16', java.version: '12.0.2'
Driver info: io.appium.java_client.ios.IOSDriver
Capabilities {additionalWebviewBundleIds: [com.amazon.Amazon.development], app: /tmp/scratchaCRY1Q.scratch/..., appName: Amazon.app.ipa, autoWebview: false, automationName: XCUITest, browserName: , bundleId: com.amazon.AmazonUK.Enterprise, databaseEnabled: false, derivedDataPath: /tmp/scratchaCRY1Q.scratch/..., deviceName: 00008101-001268642669001E, javascriptEnabled: true, locationContextEnabled: false, networkConnectionEnabled: false, newCommandTimeout: 10000, platform: MAC, platformName: iOS, takesScreenshot: true, udid: 00008101001268642669001E, useFirstMatch: true, usePrebuiltWDA: true, waitForQuiescence: false, webStorageEnabled: false}
Session ID: a9814d39-d1dd-4b22-b0c8-07b2ee356aaa
	at io.appium.java_client.AppiumDriver.context(AppiumDriver.java:231)
	at com.amazon.dtk.page.DTKModel.setWebContext(DTKModel.java:84)
	at com.amazon.leep.nativeapp.page.model.BaseDTKModel.switchWebviewWindow(BaseDTKModel.java:204)
	at com.amazon.leep.nativeapp.page.model.EverydayEssential.EEBrowsePageIOS.compareASINsOnEEAndDP(EEBrowsePageIOS.java:163)
	at com.amazon.leep.nativeapp.tests.EEMarqueeTests.EEMarqueeIOS.verifyATCOnManualCarousel(EEMarqueeIOS.java:41)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:567)
	at org.testng.internal.invokers.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:135)
	at org.testng.internal.invokers.TestInvoker.invokeMethod(TestInvoker.java:673)
	at org.testng.internal.invokers.TestInvoker.invokeTestMethod(TestInvoker.java:220)
	at org.testng.internal.invokers.MethodRunner.runInSequence(MethodRunner.java:50)
	at org.testng.internal.invokers.TestInvoker$MethodInvocationAgent.invoke(TestInvoker.java:945)
	at org.testng.internal.invokers.TestInvoker.invokeTestMethods(TestInvoker.java:193)
	at org.testng.internal.invokers.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:146)
	at org.testng.internal.invokers.TestMethodWorker.run(TestMethodWorker.java:128)
	at java.base/java.util.ArrayList.forEach(ArrayList.java:1540)
	at org.testng.TestRunner.privateRun(TestRunner.java:808)
	at org.testng.TestRunner.run(TestRunner.java:603)
	at org.testng.SuiteRunner.runTest(SuiteRunner.java:429)
	at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:423)
	at org.testng.SuiteRunner.privateRun(SuiteRunner.java:383)
	at org.testng.SuiteRunner.run(SuiteRunner.java:326)
	at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
	at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:95)
	at org.testng.TestNG.runSuitesSequentially(TestNG.java:1249)
	at org.testng.TestNG.runSuitesLocally(TestNG.java:1169)
	at org.testng.TestNG.runSuites(TestNG.java:1092)
	at org.testng.TestNG.run(TestNG.java:1060)
	at org.testng.TestNG.privateMain(TestNG.java:1407)
	at org.testng.TestNG.main(TestNG.java:1371)
Caused by: org.openqa.selenium.WebDriverException: An unknown server-side error occurred while processing the command. Original error: Missing target for given targetId
Build info: version: 'unknown', revision: 'unknown', time: 'unknown'
System info: host: 'ip-192-168-10-5.us-west-2.compute.internal', ip: 'fe80:0:0:0:c40:d01f:e7e7:3f0c%en0', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.16', java.version: '12.0.2'
Driver info: io.appium.java_client.ios.IOSDriver
Capabilities {additionalWebviewBundleIds: [com.amazon.Amazon.development], app: /tmp/scratchaCRY1Q.scratch/..., appName: Amazon.app.ipa, autoWebview: false, automationName: XCUITest, browserName: , bundleId: com.amazon.AmazonUK.Enterprise, databaseEnabled: false, derivedDataPath: /tmp/scratchaCRY1Q.scratch/..., deviceName: 00008101-001268642669001E, javascriptEnabled: true, locationContextEnabled: false, networkConnectionEnabled: false, newCommandTimeout: 10000, platform: MAC, platformName: iOS, takesScreenshot: true, udid: 00008101001268642669001E, useFirstMatch: true, usePrebuiltWDA: true, waitForQuiescence: false, webStorageEnabled: false}
Session ID: a9814d39-d1dd-4b22-b0c8-07b2ee356aaa
	at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
	at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:500)
	at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:481)
	at org.openqa.selenium.remote.http.W3CHttpResponseCodec.createException(Unknown Source)
	at org.openqa.selenium.remote.http.W3CHttpResponseCodec.decode(Unknown Source)
	at org.openqa.selenium.remote.http.W3CHttpResponseCodec.decode(Unknown Source)
	at org.openqa.selenium.remote.HttpCommandExecutor.execute(Unknown Source)
	at io.appium.java_client.remote.AppiumCommandExecutor.execute(AppiumCommandExecutor.java:239)
	at org.openqa.selenium.remote.RemoteWebDriver.execute(Unknown Source)
	at io.appium.java_client.DefaultGenericMobileDriver.execute(DefaultGenericMobileDriver.java:41)
	at io.appium.java_client.AppiumDriver.execute(AppiumDriver.java:1)
	at io.appium.java_client.ios.IOSDriver.execute(IOSDriver.java:1)
	at io.appium.java_client.AppiumDriver.context(AppiumDriver.java:228)
	... 31 more
2023-07-24 17:31:15 [main] ERROR — Exception retrieving current URL
!!! Exception was org.openqa.selenium.WebDriverException: An unknown server-side error occurred while processing the command. Original error: Missing target for given targetId
Build info: version: 'unknown', revision: 'unknown', time: 'unknown'
System info: host: 'ip-192-168-10-5.us-west-2.compute.internal', ip: 'fe80:0:0:0:c40:d01f:e7e7:3f0c%en0', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.16', java.version: '12.0.2'
Driver info: io.appium.java_client.ios.IOSDriver
Capabilities {additionalWebviewBundleIds: [com.amazon.Amazon.development], app: /tmp/scratchaCRY1Q.scratch/..., appName: Amazon.app.ipa, autoWebview: false, automationName: XCUITest, browserName: , bundleId: com.amazon.AmazonUK.Enterprise, databaseEnabled: false, derivedDataPath: /tmp/scratchaCRY1Q.scratch/..., deviceName: 00008101-001268642669001E, javascriptEnabled: true, locationContextEnabled: false, networkConnectionEnabled: false, newCommandTimeout: 10000, platform: MAC, platformName: iOS, takesScreenshot: true, udid: 00008101001268642669001E, useFirstMatch: true, usePrebuiltWDA: true, waitForQuiescence: false, webStorageEnabled: false}
Session ID: a9814d39-d1dd-4b22-b0c8-07b2ee356aaa
org.openqa.selenium.WebDriverException: An unknown server-side error occurred while processing the command. Original error: Missing target for given targetId
Build info: version: 'unknown', revision: 'unknown', time: 'unknown'
System info: host: 'ip-192-168-10-5.us-west-2.compute.internal', ip: 'fe80:0:0:0:c40:d01f:e7e7:3f0c%en0', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.16', java.version: '12.0.2'
Driver info: io.appium.java_client.ios.IOSDriver
Capabilities {additionalWebviewBundleIds: [com.amazon.Amazon.development], app: /tmp/scratchaCRY1Q.scratch/..., appName: Amazon.app.ipa, autoWebview: false, automationName: XCUITest, browserName: , bundleId: com.amazon.AmazonUK.Enterprise, databaseEnabled: false, derivedDataPath: /tmp/scratchaCRY1Q.scratch/..., deviceName: 00008101-001268642669001E, javascriptEnabled: true, locationContextEnabled: false, networkConnectionEnabled: false, newCommandTimeout: 10000, platform: MAC, platformName: iOS, takesScreenshot: true, udid: 00008101001268642669001E, useFirstMatch: true, usePrebuiltWDA: true, waitForQuiescence: false, webStorageEnabled: false}
Session ID: a9814d39-d1dd-4b22-b0c8-07b2ee356aaa
	at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
	at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:500)
	at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:481)
	at org.openqa.selenium.remote.http.W3CHttpResponseCodec.createException(Unknown Source)
	at org.openqa.selenium.remote.http.W3CHttpResponseCodec.decode(Unknown Source)
	at org.openqa.selenium.remote.http.W3CHttpResponseCodec.decode(Unknown Source)
	at org.openqa.selenium.remote.HttpCommandExecutor.execute(Unknown Source)
	at io.appium.java_client.remote.AppiumCommandExecutor.execute(AppiumCommandExecutor.java:239)
	at org.openqa.selenium.remote.RemoteWebDriver.execute(Unknown Source)
	at io.appium.java_client.DefaultGenericMobileDriver.execute(DefaultGenericMobileDriver.java:45)
	at io.appium.java_client.AppiumDriver.execute(AppiumDriver.java:1)
	at io.appium.java_client.ios.IOSDriver.execute(IOSDriver.java:1)
	at org.openqa.selenium.remote.RemoteWebDriver.getCurrentUrl(Unknown Source)
	at com.amazon.dtk.listener.TestNGCustomReport.saveBrowserInfo(TestNGCustomReport.java:101)
	at com.amazon.dtk.listener.TestNGCustomReport.onTestFailure(TestNGCustomReport.java:56)
	at com.amazon.dtk.listener.DiamondToolkitListener.onTestFailure(DiamondToolkitListener.java:132)
	at org.testng.internal.TestListenerHelper.runTestListeners(TestListenerHelper.java:99)
	at org.testng.internal.invokers.TestInvoker.runTestResultListener(TestInvoker.java:276)
	at org.testng.internal.invokers.TestInvoker.invokeMethod(TestInvoker.java:744)
	at org.testng.internal.invokers.TestInvoker.invokeTestMethod(TestInvoker.java:220)
	at org.testng.internal.invokers.MethodRunner.runInSequence(MethodRunner.java:50)
	at org.testng.internal.invokers.TestInvoker$MethodInvocationAgent.invoke(TestInvoker.java:945)
	at org.testng.internal.invokers.TestInvoker.invokeTestMethods(TestInvoker.java:193)
	at org.testng.internal
asked 10 months ago59 views
No Answers

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions