We are actually trying to automate the APP in our org and we have successfully done with the configuration of Appium using XCUITEST and we are able to launch the app in real device.
Now actually our app is developed in angular and the code base is same for IOS, Browser and Android.
Issue that we are facing is when we try to inspect the element in appium it always shows up the xpath that is native in nature like XCUIElement kind of , but in browser and other tool like seetest is able to find the xpath in xml way like class, id, text. when we tried using this xml kind of xpath appium fails.
Can anyone help us in making normal xpath work.
Example Xpath found in browser : xpath=//*[@id=âhome-page-pending-pickcount-pickup-2â]
How to make this xpath work in appium as this ID is given my our devolopment team and this is not showed in Appium inspector.
We did that and i got the Page Source from appium, but there is a difference between the source that is shown in Appium and source showed in chrome browser for the same app.
For Example :
According to appium this is the xpath for my app : //XCUIElementTypeTextField[@value=âUsernameâ]
In browser/Seetest tool the Xpath for same element id like this : //*[@id=âlogin-usernameâ]
Now the question is how there are 2 xpaths for same element , same app, just that the tool is different. I guess that the appium is getting the NATIVE Xpath.
Is there an option to make the browser xpath work with some change in appium capabilities.
In both source we can see that the Username and password field showed in Appium inspector and the page source original is different.
Actually our dev have given the idâs to the element the problem is we cannot use that as its not showing up in appium and hence not working also if forcibly tried with the xpath with id.
MobileElement el = driver.findElement(MobileBy.iOSNsPredicateString(âtype == âXCUIElementTypeTextFieldâ AND value == 'Usernameâ AND visible == 1â)) // name is ID in most cases
// or just
MobileElement el = driver.findElement(MobileBy.iOSNsPredicateString(âtype == âXCUIElementTypeTextFieldâ AND visible == 1â)); // name is ID in most cases
tap login:
driver.findElement(MobileBy.iOSNsPredicateString(âtype == âXCUIElementTypeButtonâ AND name == 'Log inâ AND visible == 1â)).click();
Yeah i used something like this :
driver.findElement(By.xpath("//XCUIElementTypeTextField[@value=âUsernameâ]")).sendKeys("[email protected]");
driver.findElement(By.xpath("//XCUIElementTypeSecureTextField[@value=âPasswordâ]")).sendKeys(âpasswordâ);
and it works fine.
Now there are some page for example i have attached page source, there is no ID for the edit box according to appium but i can use class according to browser xpath.
Here there is XCUIElementTypeTextField but no properties according to appium, but i have written xpath like this to make it work like below :
The problem that we are facing is they are telling that they have provided the IDâs, class uniquely for the element, as appium is showing only Native elements only we cant use it.
And we are QA Automation engineers and we dont have the source code with us to change. We have just the debug enabled ipa , apk.
I tried using the ios_webkit_proxy and added the desired capabilities in appium scripts but appium iam getting message as no Webview found and its retrying.
The only question i have is if there is a option in appium/wda to make normal xpath work as other tools are showing the xpaths in normal way (Like we are analyzing Seetest) which actually xml instead of Native.
Also we need to use the script for runnning in iOS, Android and Browser, i dont know if i use this Native xpath, it will work in all 3 devices.
I dont think its anything to do with Angular, as there is no NG elements in our application, if there is a way to switch to Webview in appium forcefully then it should be able to identify the normal html Xpaths. But i dont see any way to switch it in appium.
Actually i had a discussion with my dev, our app is devoloped in corodova framework and the problem is the appium is not able to find the webviews and there has been issues previosly also with corodova apps with appium, i have tried using the ios-webkit-proxy, with that also i get the same message no webframes found.
Tried a lot but still not able to get the solution.