Not able to identify element in WEBVIEW in iOS hyprid app automation using Appium on real device

懵懂的女人 提交于 2019-12-01 12:07:11
Naman
  1. Continues of from here : How to enable and use WebView for iOS Automation in Appium

Try and use the following code to switch contexts :

var contextNames = driver.GetContexts(); //correction to your code 
driver.SetContext(contextNames[1]);
  1. You don't necessarily need the following capability while using appium :

    capabilities.SetCapability("browserName", "iOS"); //can be removed from code as well
    
  2. I am guessing you might be trying to use Appium Inspector along with running/debugging your tests. In which case you might not be able to use both the instances. Please look into the appium server logs for details on this.

I think you have to Set up UICatalog in Appium

  1. Copy this link in xcode : https://github.com/appium/ios-uicatalog

  2. Search the repository where we have the UICatalog.app installed Users/Library/Developer/Xcode/DerivedData/UICatalog-bhmtevqhmgarbcgnqybxttbkqfvn/Build/Products/Debug-iphonesimulator/UICatalog.app

  3. Copy it into app path in Appium ios settings

1) While access ios webview -- using getcontextHandles we can achieve

Set contextNames = idriver.getContextHandles();

System.out.println(contextNames);

for (String contextName : contextNames) {
  if (contextName.contains("NATIVE_APP")) {
    Reporter.log("Reaching to Native App", true);
    idriver.context(contextName);
    sleepfor(1000);
    idriver.findElementByName("Open").click();
    Reporter.log("Clicking Open to naviagte to Native APP", true);
  }
  else{
    Reporter.log("Not found", true);
  }
}

2) If above context doesn't work -- try to run iproxy run this in terminal -- ios_webkit_debug_proxy -c deviceID:27753 -d deviceID -- to get device id (instruments -s devices)

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!