Skip to main content

ContextActions

Static methods​

withContext​

This will return IContextActions which will expose different methods to handle different contexts.

IContextActions contextActions = ContextActions.withContext ();
Important!!

In order to use these contexts related methods, your app must be set as HYBRID in your boyka-config.json file.

Example​

{
"ui": {
"timeout": {
// ...
},
"logging": {
// ...
},
"screenshot": {
// ...
},
"web": {
// ...
},
"mobile": {
"device_config": {
"server": {
// ...
},
"device": {
// ...
"swipe": {
// ...
},
"application": {
// ...
"type": "HYBRID"
},
"virtual_device": {
// ...
}
}
}
}
},
"api": {
// ...
}
}

Instance methods​

contexts​

This method will get the list of all the available contexts on the screen.

import static io.github.boykaframework.actions.drivers.ContextActions.withContext;
. . .
var contextList = withContext ().contexts ();

currentContext​

This method will get the current context name on the screen.

import static io.github.boykaframework.actions.drivers.ContextActions.withContext;
. . .
var contextName = withContext ().currentContext ();

switchToNative​

This method will switch current context to native context. This will work only for Hybrid application type.

import static io.github.boykaframework.actions.drivers.ContextActions.withContext;
. . .
withContext ().switchToNative ();

switchToWebView (name)​

This method will switch the context to mentioned context name. This will work only for Hybrid application type.

import static io.github.boykaframework.actions.drivers.ContextActions.withContext;
. . .
withContext ().switchToWebView ("WEBVIEW_xxxx");

switchToWebView​

This method will switch the context to first available Web view context. This will work only for Hybrid application type.

import static io.github.boykaframework.actions.drivers.ContextActions.withContext;
. . .
withContext ().switchToWebView ();