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 ();