Can you find XPath for mobile apps? Now WE CAN !!
Dharmalingam Krishnan
All about QA at Visteon | Certified Scrum Master | Youtuber @ TechieQA | Full-Stack Tester | Selenium,Appium(Android/iOS),Cypress,Jmeter,Postman | AWS , Kubernetes , Docker
XPath is a locator which is used to automate the web and mobile application. not only XPath we can use id, XPath name,text..etc.
But if doesn't have any unique locator we go for XPath. To find XPath for the web applications we have so many plugins like Firebug, Firepath and all. But for the mobile application only appium inspector was there, that also only for iOS.
Now we got one more tool to find XPath for both android and iOS application.
Macaca Inspector
For Macaca inspector first thing you should be installed NodeJS
Then need to install Macaca Inspector with the following command
$ npm i app-inspector -g
Next, you have to connect your android/ios device(for android adb setup has to be done) and run the below command to start Macaca inspector.
app-inspector -u <device uid>
Once inspector get started you can view the all the mobile element properties with XPath.
Enjoy automating !! Enjoy Testing
after run og app-inspector -u c3bec4020603 got error: { Error: Command failed: C:\Program Files (x86)\Android SDK/platform-tools/adb - s c3bec4020603 forward tcp:9001 tcp:9001 'C:\Program' is not recognized as an internal or external command, operable program or batch file. at ChildProcess.exithandler (child_process.js:204:12) at emitTwo (events.js:106:13) at ChildProcess.emit (events.js:191:7) at maybeClose (internal/child_process.js:886:16) at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5) killed: false, code: 1, signal: null, cmd: 'C:\\Program Files (x86)\\Android SDK/platform-tools/adb -s c3bec4020603 forward tcp:9001 tcp:9001' } ^CTerminate batch job (Y/N)? y
There are lots of other tools also to find elements of mobile apps, if we talk about iOS than Calabash is one of the powerful tool, we can easily find elements by applying queries.
Staff Quality Architect @Vonage| Ex: Quality Analyst @Thoughtworks | Test Automation Specialist | ML enthusiast| AWS Cloud Practitioner | Mentor | Blogger
8 年I am getting the following error while running app-inspector -u <device uid> app-inspector:66:44 [master] pid:10312 Error: Cannot find module 'uiautomator-client' I tried installing uiautomator-client but getting following error: C:\Users\dimpy.adhikary\AppData\Roaming\npm\node_modules\uiautomator-client\scripts\build.js:177 throw e; ^ TypeError: Cannot read property 'replace' of undefined at spawn (C:\Users\dimpy.adhikary\AppData\Roaming\npm\node_modules\uiautomator-client\node_modules\win-spawn\index.js:7:22) at Promise (C:\Users\dimpy.adhikary\AppData\Roaming\npm\node_modules\uiautomator-client\scripts\build.js:143:24) at buildBootstrap (C:\Users\dimpy.adhikary\AppData\Roaming\npm\node_modules\uiautomator-client\scripts\build.js:142:10) at process._tickCallback (internal/process/next_tick.js:103:7) npm ERR! Windows_NT 10.0.10240 npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "-g" "uiautomator-client" npm ERR! node v7.4.0 npm ERR! npm v4.0.5 npm ERR! code ELIFECYCLE npm ERR! [email protected] install: `node ./scripts/build.js` npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the [email protected] install script 'node ./scripts/build.js' Can you help me on this please, do I missed anything?