Hi,
I am writing test for a hybrid Android app using Appium Nodejs with WebDriverIO.
I am able to test the native screens well. I am not able to change context to webview.
The code to change context looks as follows
var ctxs1 = await client.getContexts();
console.log("Available Contexts in fitBitLogin-----");
console.log(ctxs1);
ctxs1.every(async function(value, index, array) {
if(value.includes('WEBVIEW')) {
await client.switchContext(value);
return false;
}
return true;
})
The following are the logs. You can see that both native and webview contexts are available. But changing the context to webview is failing.
2022-10-01T19:13:50.492Z INFO webdriver: COMMAND getContexts()
2022-10-01T19:13:50.492Z INFO webdriver: [GET] http://127.0.0.1:4723/wd/hub/session/d9377f5a-50d8-44db-9d09-f16f92aaf511/contexts
2022-10-01T19:13:51.723Z INFO webdriver: RESULT [ 'NATIVE_APP', 'WEBVIEW_chrome' ]
Available Contexts in fitBitLogin-----
[ 'NATIVE_APP', 'WEBVIEW_chrome' ]
2022-10-01T19:13:51.723Z INFO webdriver: COMMAND switchContext("WEBVIEW_chrome")
2022-10-01T19:13:51.724Z INFO webdriver: [POST] http://127.0.0.1:4723/wd/hub/session/d9377f5a-50d8-44db-9d09-f16f92aaf511/context
2022-10-01T19:13:51.724Z INFO webdriver: DATA { name: 'WEBVIEW_chrome' }
2022-10-01T19:14:16.728Z INFO webdriver: COMMAND findElement("xpath", "//*[@id='ember654']")
2022-10-01T19:14:16.728Z INFO webdriver: [POST] http://127.0.0.1:4723/wd/hub/session/d9377f5a-50d8-44db-9d09-f16f92aaf511/element
2022-10-01T19:14:16.728Z INFO webdriver: DATA { using: 'xpath', value: "//*[@id='ember654']" }
2022-10-01T19:15:03.858Z WARN webdriver: Request failed with status 500 due to An unknown server-side error occurred while processing the command. Original error: Process didn't end after 10000ms (cmd: '/opt/chromedriver/linux/65/chromedriver --url-base\=wd/hub --port\=8000 --adb-port\=5037 --verbose')
Please note, on my local machine, with an Android emulator, the test works without any issues.
Any guidance/help will be very useful. Do let me know if you need more inputs.
Thanks!
Hi Parag, I am facing the same issue. Were you able to solve this ? If yes, can you please guide me on the steps.