MCPcopy Index your code
hub / github.com/codeceptjs/CodeceptJS / switchToWeb

Method switchToWeb

lib/helper/Appium.js:905–917  ·  view source on GitHub ↗

* Switches to web context. * If no context is provided switches to the first detected web context * * ```js * // switch to first web context * I.switchToWeb(); * * // or set the context explicitly * I.switchToWeb('WEBVIEW_io.selendroid.testapp'); * ``` * * @return {P

(context)

Source from the content-addressed store, hash-verified

903 * @param {string} [context]
904 */
905 async switchToWeb(context) {
906 this.isWeb = true
907 this.defaultContext = 'body'
908
909 if (context) return this.switchToContext(context)
910 const contexts = await this.grabAllContexts()
911 this.debugSection('Contexts', contexts.toString())
912 for (const idx in contexts) {
913 if (contexts[idx].match(/^WEBVIEW/)) return this.switchToContext(contexts[idx])
914 }
915
916 throw new Error('No WEBVIEW could be guessed, please specify one in params')
917 }
918
919 /**
920 * Switches to native context.

Callers 4

_withinBeginMethod · 0.95
Appium_test.jsFile · 0.80
AppiumTs.types.tsFile · 0.80
Appium.types.tsFile · 0.80

Calls 3

switchToContextMethod · 0.95
grabAllContextsMethod · 0.95
toStringMethod · 0.45

Tested by

no test coverage detected