Closed ghost closed 7 years ago
For anyone else who is struggling with this and wanting to test Android Selenium has an android capability that can not use ChromeDriver to take screenshots but can use ADB. The capability is: nativeWebScreenshot: true
Not sure where is the best place to post this so apologies!
When working with a hybrid application I am unable to take a screenshot on the Android emulator. After updating to the latest chromedriver I have the following error:
unknown error: unhandled inspector error: {"code":-32603,"message":"Unable to capture screenshot"}
The issue is that when using ChromeDriver and running in the WebContext it is unable to take a screenshot. If I switch to the native context then it can (tested and confirmed to be the case).
However, when I switch to the native context wdio-visual-regression-service fails (and hence posting here) with browser.checkDocument is not recognized as it tries to execute the following against the native app context:
window.navigator.userAgent;
Which fails miserably.
So - is knowing the user agent necessary? I might try taking this out but thought I would ask people with more knowledge first!OK so even if you remove this call there is then a call to getURL etc which fails so this is a no go.A potential alternative if you need the UA might be to update wdio-screenshot so that the before screenshot hook optionally switches context to the native context and then the after screenshot hook optionally changes back to the web view context.Yeah this also didn't work - just need it fixed in Chromedriver really!Any ideas if either of the above approaches could solve this?
Thanks