Hi,
Hybrid native app + appium + protractor.
I’m having trouble with the ‘autowebview’ appium capability. I suspect it is a race condition between a slow emulator changing contexts and protractor sending commands only supported by a webview context.
What I’d like to do is manually set the context to WEBVIEW, in Protractor’s onPrepare callback.
There are code snippets out there like the following:
onPrepare: function () {
var wd = require('wd'),
wdBridge = require('wd-bridge')(protractor, wd),
_ = require('underscore');
wdBridge.initFromProtractor(exports.config);
return wdBrowser.contexts().then(function (ctxs) {
var webCtx = _(ctxs).find(function (ctx) {
return ctx.match(/WEBVIEW/);
});
return wdBrowser.context(webCtx)
});
}
However, in my case ‘wdBrowser.contexts’ is undefined. I’ve snooped around and can’t find a reference to that function. I see that it is a defined command in wd.
It’s clearly defined by WebdriverIO, in it’s appium section, but I’m not quite ready to abandon protractor.
Thanks for any help.