Web application development trends have shifted towards designing apps that are also accessible to mobile devices. Due to responsive design, it becomes easy for app developers to develop a website to run on various devices.
The tester’s job then becomes critical, because the application needs to be tested on all of the supported devices, or the tester cannot guarantee that application will run well on any particular device. This is more time consuming when an application supporting various mobile device platforms has different browsers and versions. Automation relieves the stress of this problem if implemented with a good automation tool, such as Selenium with a robust framework.
With the automation process, it is more challenging when the automation tester needs information about the web elements that are going to be used in automation scripts. Unlike on desktop browsers, web browsers on mobile devices do not provide any in-built facility to inspect an element. However, there are a few tools available can make the job easier.
- Google chrome on desktop provides an option to remotely access DOM of the web application running on Android using Developer-tools. User can monitor it live on his machine.
- Weinre is an open source tool which can debug web pages on android, iOS, Firefox OS and windows.
- Safari version 6+ also provides a feature to remotely debug web applications on iOS for Macs. I am not going to cover this option now, as it is similar to debugging Google chrome on Android.
[See Also: Appium: iOS UI Software Test Automation]
Remote Debugging Using Chrome Developer Tools
Chrome 32 and later needs to be installed
- Android 4.0 + and Chrome on device
- Android 4.4+ for app debugging and webview configured
Note: The version of Chrome on your desktop needs to be higher than the version on Android
- Enable USB debugging on the device by clicking Settings > Developer Options > USB debugging (device only).
- Connect the phone to a machine using a USB cable or start an emulator locally.
- After setting up your device, open chrome://inspect/ on your desktop Chrome.
- Check Discover USB devices. If confirmation popups appear, just click OK. If the device is properly connected, the device will be shown as found, as below.
- Open Chrome on your device/emulator.
- You can now see Chrome with version and provision to open a URL on devices.
- Provide an application URL. You can now see application URL and inspect link below.
Note: You can open multiple tabs in a browser; all will be listed in your desktop Chrome. You can also focus the required tab, reload or close tab remotely from your machine.
- Now it is time to debug the code, so click on inspect link to open the developer tools window.
- Hover or click on the element you want; it will be highlighted in the device.
It also provides to feature to find an element on the page. Click on the icon and click on the desired element, in case you are using emulator.
[See Also: 4 Steps for Assessing Mobile App Development Strategy]
Remote Debugging Using Weinre
Weinre is an open source debugging tool, used to debug web applications running on Android OS, FireFox OS, iOS or Windows. It supports Chrome, Safari or any WebKit–based browsers.
- Debug server: HTTP server used by Debug client and Debug target.
- Debug client: web inspector for the application similar to developer-tools.
- Debug target: web application running on your mobile device.
Setting Up Server
(It can be on your local machine)
- Weinre is based on node.js, download node.js and install it on your server machine.
- Install weinre as npm package using the command:sudo npm –g install weinre That is all; your server is ready! Start it using the command weinre. Itwill start on default 8080 port; you can change it using weinre
–httpPort <port number>. Check more options using weinre
- The server home page is accessible using http://<IP address of the server>:<port>/
- Open debug client using the http://<IP of the server> : <port>/client/#anonymous on your machine. This link is available on home page.
- Connect your device or emulator using Wi-Fi to network so that server can access it. Try accessing server home page URL on device browser. If it opens, then your device is connected to server.
<script src=”http:// <IP address of the server>:
- Open your script injected web page in the device browser. It will be shown in the Remote tab of the debug client on your machine.
- Now you can debug your web page using the Elements tab of the client.
Everything you need to know about outsourcing technology development
Access a special Introduction Package with everything you want to know about outsourcing your technology development. How should you evaluate a partner? What components of your solution that are suitable to be handed off to a partner? These answers and more below.