* 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)
| 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. |
no test coverage detected