After launching the hybrid app build in Ionic2/Angular2/Typescript, I am changing the context using below code:
var contextNames=driver.Contexts;
driver.Context= contextNames[1]; //changing context to WEBVIEW
driver.FindElementByXPath(“locator”).Click(); //getting error on this step
After switching context I tried to use xpath from Appium inspector as well as from safari develop window
Appium Xpath = //UIAApplication1/UIAWindow1/UIAButton
Safari Xpath = //*[@placeholder=‘Username’ and @class=‘ng-untouched ng-pristine ng-valid’]
As I am working on hybrid app
- I installed ios_webkit_debug_proxy on mac
- Started the same on 27753 port
- In machine’s mac browser localhost:27753 gives the link
- Clicked on the link which displays the elements of the webview app which is currently running on connected device
- Took above safari xpath from here
For more details on the capabilities used and screenshot related to the error please navigate to link
Getting below error
info: [debug] [REMOTE] Executing ‘find_element’ atom in default context
info: [debug] [REMOTE] Sending javascript command
info: [debug] [REMOTE] Remote debugger data sent [{“method”:“Runtime.evaluate”,“params”:{“objectGroup”:“console”,“includeCommandLineAPI”:true,“doNotPauseOnExceptionsAndMuteConsole”:true,“expression”:"(function(){return function(){function h(a){return…]
info: [debug] [REMOTE] Debugger web socket received data: {“result”:{“result”:{“type”:“string”,“value”:“{"status":0,"value":null}”},“wasThrown”:false},“id”:53}
info: [debug] Waited for 29725ms so far