I was trying to automate the hybrid app build using ionic2/Angular2 and typescript.
I am using C# for code writing. test are in BDD - specflow Versions: iOS:9.3.1 Xcode: 7.3 Appium: 1.4.13
I am not able to identify elements after swtiching Context to WEBVIEW.
Calling IOSDriver using below code
private IOSDriver driver = null;
public IOSDriver GetDriver(string platformVersion, string deviceName, string udid ,string appPath, string serverUri)
Capabilities iosCapabilities = new Capabilities();
DesiredCapabilities capabilities = iosCapabilities.Get(platformVersion, deviceName, udid, appPath);
driver = new IOSDriver(new Uri(serverUri), capabilities, TimeSpan.FromSeconds(Constants.DriverWaitTime));
driver.Manage ().Timeouts ().ImplicitlyWait (TimeSpan.FromSeconds(Constants.ImplicitWaitTime));
var contextNames = driver.Contexts;
driver.Context = contextNames;
Setting Capabilities as
private DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.SetCapability ("appium-version", Constants.AppiumVersion);
capabilities.SetCapability ("platformName", Constants.PlatformName);
capabilities.SetCapability ("platformVersion", Constants.PlatformVersion);
Am I setting the capabilities in correct way?
1. I checked using browserName capbility as blank/safari but didn't worked
2. Also, I installed ios-webkit-debug-proxy and started proxy using terminal in background on my mac
Problem is I am not able to identify elements in WEBVIEW even after switching the context.
After launching the app, in appium inspector I am able to see all the elements and I am trying to click on textbox to enter some value
Xpath of textbox(as i can view in appium inspector window):
var contextNames = driver.Contexts
is giving me list to views(In my case 2 views: NATIVE_APP, WEBVIEW_1) WebView context is dynamically updating from 1,2,3 and so on..
As soon as I call
diver.Context=contextNames; //setting context to WEBVIEW
and refresh the appium inspector I am not able to see/identify single element.Everything goes away.
Why I am not able to see/identify elements after switching to webview. (Note: As soon as I Switch back to driver.Context="NATIVE_APP" every element becomes visible in appium inspector but still I am not able to click)
Error is thrown as: "An element could not be located using given search parameter"
Manually also when I try to tap or sendkeys using appium inspector it is not letting me do so(after lauching tha app manually using inspector button). What is the issue here. Help would be highly appreciated
Error message as in appium window:
Error log on Appium Logs(Not able to view elements in WEBVIEW after switching context
Do verify the capabilities which I am using before switching the context. Thanks in advance