question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

iOS 13.3 Appium not responding after switchContext to WebView

See original GitHub issue

The problem

Appium stops responding after attempting to switchContext(‘WEBVIEW…’).

Environment

  • Appium version: 1.16.0
  • Node.js version: 10.17.0
  • Npm: 6.13.3
  • Mobile platform/version under test: iOS 13.3
  • Real device or emulator/simulator: Simulator
  • Appium CLI or Appium.app|exe: CLI via webdriver.io

Details

In my setup I have a cordova app that successfully installs and launches. When attempting to switch to the webview context, Appium stops responding. The POST requests to /context time out.

Might be a wdio thing but if I enter debug first (browser.debug()) and browser.switchContext('WEBVIEW...') no response is received, further commands are ignored.

This issue does not occur on an iOS 13.2.2 simulator. Here’s how to install older simulators if you need to get around this.

Similar to #13361 and #13799 but they’re running older iOS versions.

Link to Appium logs

Appium and wdio logs

Code To Reproduce Issue [ Good To Have ]

This is using the wdio cli with Mocha. You probably get the idea of what it’s doing otherwise.

let pollCount = 0;
const pollForWebview = async () => {
    const contexts = await browser.getContexts();
    const webContext = contexts.find(context => context.startsWith('WEBVIEW'));
    if(webContext) return webContext;
    if(pollCount < 3) return browser.pause(1000).then(pollForWebview);
}

describe('app:', () => {
    it('loads', async () => {
        console.log('hello!');
        const webContext = await pollForWebview();
        await browser.switchContext(webContext);
        const context = await browser.getContext();
        console.log(context);
    });
});

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:11 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
imurchiecommented, Jan 9, 2020

Thanks for getting this together! I will see what I can do!

0reactions
imurchiecommented, Jan 16, 2020

Excellent! Glad it got working!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Can't switch context to webview - Issues/Bugs - Appium Discuss
In the inspector i see only “no context” and can't switch to a webview context like the tutorial explains. When i try to...
Read more >
Can't switch context to webview - Issues/Bugs - Appium Discuss
Hello I am testing a native app in appium and i'd like to test a part in the app where it redirects into...
Read more >
How to switch context from native to Webview? - Support
Hi,. I have a problem in switching my Hybrid application from Native APP context view to Web Context view with new Appium 1.6.4...
Read more >
iOS Can't switch context or even list contexts - Issues/Bugs
In my tests, I'm trying to determine if specific elements are displayed on the screen in a web view. I've tried different variations...
Read more >
Set Context - Appium
iOS - attempt to connect to the application through the remote debugger; Android - start a Chromedriver process and begin a session to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found