Set<String> contextNames = driver.getContextHandles();
for (String contextName : contextNames) {
System.out.println(contextName); //prints out something like NATIVE_APP \n WEBVIEW_1
}
Thread.sleep(5000);
**driver.context((String)contextNames.toArray()[1]);** When this line execute at that time error comes
output
May 03, 2020 2:34:52 PM io.appium.java_client.remote.AppiumCommandExecutor$1 lambda$0
INFO: Detected dialect: W3C
Session is created
NATIVE_APP[code.txt|attachment](upload://hBvd1u1siHu4xPgOGkRB3eMDZ6r.txt) (1.9 KB) [AppiumError.txt|attachment](upload://reGkVVCIf4t0UsUYWmWAhbn5Pb0.txt) (4.7 KB)
WEBVIEW_com.XX.XXXXX
Error while switching from native to Webview
Exception in thread “main” io.appium.java_client.NoSuchContextException: An unknown server-side error occurred while processing the command. Original error: No Chromedriver found that can automate Chrome ‘74.0.3729’. You could also try to enable automated chromedrivers download server feature. See https://github.com/appium/appium/blob/master/docs/en/writing-running-appium/web/chromedriver.md for more details
Build info: version: ‘3.13.0’, revision: ‘2f0d292’, time: ‘2018-06-25T15:32:14.902Z’
System info: host: ‘MOHTASIM’, ip: ‘192.168.0.103’, os.name: ‘Windows 10’, os.arch: ‘amd64’, os.version: ‘10.0’, java.version: ‘1.8.0_231’
Driver info: io.appium.java_client.android.AndroidDriver
Capabilities {app: C:\Users\Admin\eclipse-work…, appPackage: com.avanoo.storyApp, autoAcceptAlerts: true, autoGrantPermissions: true, chromeOptions: {w3c: false}, databaseEnabled: false, desired: {app: C:\Users\Admin\eclipse-work…, autoAcceptAlerts: true, autoGrantPermissions: true, chromeOptions: {w3c: false}, deviceName: Nexus_S_API_29, platformName: android, unicodeKeyboard: true}, deviceApiLevel: 29, deviceManufacturer: Google, deviceModel: Android SDK built for x86, deviceName: emulator-5554, deviceScreenDensity: 240, deviceScreenSize: 480x800, deviceUDID: emulator-5554, javascriptEnabled: true, locationContextEnabled: false, networkConnectionEnabled: true, pixelRatio: 1.5, platform: LINUX, platformName: Android, platformVersion: 10, statBarHeight: 36, takesScreenshot: true, unicodeKeyboard: true, viewportRect: {height: 764, left: 0, top: 36, width: 480}, warnings: {}, webStorageEnabled: false}
Session ID: 5c364575-c89b-4b7a-a12a-8816428d9c53
at io.appium.java_client.AppiumDriver.context(AppiumDriver.java:231)
at Avanoo.Emulator_test.main(Emulator_test.java:57)
Caused by: org.openqa.selenium.WebDriverException: An unknown server-side error occurred while processing the command. Original error: No Chromedriver found that can automate Chrome ‘74.0.3729’. You could also try to enable automated chromedrivers download server feature. See https://github.com/appium/appium/blob/master/docs/en/writing-running-appium/web/chromedriver.md for more details
Build info: version: ‘3.13.0’, revision: ‘2f0d292’, time: ‘2018-06-25T15:32:14.902Z’
System info: host: ‘MOHTASIM’, ip: ‘192.168.0.103’, os.name: ‘Windows 10’, os.arch: ‘amd64’, os.version: ‘10.0’, java.version: ‘1.8.0_231’
Driver info: io.appium.java_client.android.AndroidDriver
Capabilities {app: C:\Users\Admin\eclipse-work…, appPackage: com.avanoo.storyApp, autoAcceptAlerts: true, autoGrantPermissions: true, chromeOptions: {w3c: false}, databaseEnabled: false, desired: {app: C:\Users\Admin\eclipse-work…, autoAcceptAlerts: true, autoGrantPermissions: true, chromeOptions: {w3c: false}, deviceName: Nexus_S_API_29, platformName: android, unicodeKeyboard: true}, deviceApiLevel: 29, deviceManufacturer: Google, deviceModel: Android SDK built for x86, deviceName: emulator-5554, deviceScreenDensity: 240, deviceScreenSize: 480x800, deviceUDID: emulator-5554, javascriptEnabled: true, locationContextEnabled: false, networkConnectionEnabled: true, pixelRatio: 1.5, platform: LINUX, platformName: Android, platformVersion: 10, statBarHeight: 36, takesScreenshot: true, unicodeKeyboard: true, viewportRect: {height: 764, left: 0, top: 36, width: 480}, warnings: {}, webStorageEnabled: false}
Session ID: 5c364575-c89b-4b7a-a12a-8816428d9c53
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)
at org.openqa.selenium.remote.http.W3CHttpResponseCodec.createException(W3CHttpResponseCodec.java:187)
at org.openqa.selenium.remote.http.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:122)
at org.openqa.selenium.remote.http.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:49)
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:548)
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.android.AndroidDriver.execute(AndroidDriver.java:1)
at io.appium.java_client.AppiumDriver.context(AppiumDriver.java:228)
… 1 more