Archive | mobile RSS feed for this section

Network (HTTP, etc.) packet capture setup across different client devices

21 Dec

General methods across all devices

These methods should work for all devices, for most use cases, and can be used when you can’t directly capture traffic from the device itself (unlike laptops, desktop computers).

Proxy client traffic to a host that can do packet capture

  1. Have a host machine like your Mac/Windows/etc. laptop to do the capture, using wireshark/tshark/ tcpdump.
  2. Use/install a proxy server on the host machine (e.g. Charles proxy on Mac, Fiddler on Windows).
  3. Follow the proxy instructions to install the proxy’s SSL certificate to your client devices under test (in case you need to capture/decrypt SSL/HTTPS/WSS traffic).
  4. Route/enable the client device’s (wifi) network connection to use an (HTTP) proxy, entering the values for your given proxy (the defaults or your own customized values you set on the proxy server).
  5. Start proxy server on host machine.
  6. Start capture on host machine.
  7. Generate the desired traffic activity on client device.
  8. Stop capture on host machine.
  9. Stop proxy server on host machine.
  10. Disable/unroute client device network traffic over the proxy.

NOTE: this probably only works provided the client traffic is based on HTTP/HTTPS/WS/WSS, where the capture will also capture the TCP/UDP packets. Not sure if it goes through other protocols whether this will work. Although most mobile devices use HTTP/HTTPS anyhow.

Shared/open network sniffing/capture

With this setup, you have a host machine like your Mac/Windows/etc. laptop or some server or Raspberri Pi to do the capture, using wireshark/tshark/ tcpdump. This host resides on a network where traffic is broadcast on all the ports (e.g. use of hub instead of switch and router, etc. at the lowest leaf level of the network where the testbed is set up) and thus said desired traffic is available to the host machine to sniff & capture.

For this simply ensure the target client to capture is in some way connected to this open sniffing/capture network, and then you can do the capture at any time as desired.

If the clients are wireless, that means the access point has to be connected to this open sniffing/capture LAN to capture the traffic.

Device specific traffic capture

iOS traffic capture

To save hassle of dealing iOS device UUID (finding it with XCode/iTunes, and then making use of it), use the script from here to wrap the process for you:

Once that is done and the tool is started to allow capture for (USB) attached iOS device, simply use the interface(s) rviN, where N is a number starting from 0 (typically rvi0 for single device), with the capture tool (Wireshark, tshark, tcpdump). Follow the tool commands to stop the interface service after done capturing.

NOTE: this method is only for use with a Mac. For Windows, Linux, you might first need to install some software to be able to do this: your account to preview links.

Android traffic capture

There can be multiple options for traffic capture here, more especially if the client device is rooted. However, we’ll go with the simplest approach at the moment:

Use tPacketCapture app from Google Play Store.

To use the app for capture:

  1. Open the app.
  2. Click Capture button. Button name should change to Running, and a key-like icon will then show up in the upper/top left corner of the status bar of the device, for access to stop/disconnect the capturing.
  3. Note the filename for this capture listed under “Current File” section, for reference.
  4. Generate the desired traffic activity on client device.
  5. Stop the capture by accessing the key-like icon at upper/top left corner of device.
    1. in the popup that appears choose disconnect (or equivalent) option.
    2. optionally kill the app to save resources, and kill whatever other apps were used for generating traffic to capture.
  6. Transfer the capture file from the device to a computer for further analysis and permanent storage if desired.
    • can transfer over USB cable connection, using like Android File Transfer tool on Mac, or equivalent on Windows (which should have native file storage access over Windows Explorer).
    • can transfer over NFC
    • The capture files can be found under a path like (internal storage of Android device)/Android/data/
    • you can optionally delete the files from the device afterwards to save space & for less cluster/confusion.

Make a good suggestion (to open source) and things will come

13 Sep

Post a bit delayed compared to a recent mobile automation feature release, as I’ve been busy. But wanted to mention about this. And also relevant to those who ask how they can help/contribute to open source. Sometimes, all it takes is a good idea/suggestion.

Long time back, I made a suggestion to Appium project about being able to have additional “find element by” logic using images, similar to what Sikuli does, and suggested how the implemented command may be used by a user. It was put under consideration, and recently implemented.

The original request:

And article about the recent implementation:

A page object representing both desktop and mobile views or website and mobile app

2 Mar

It just occurred to me today, from reading a Selenium forum post, that a past blog post of mine can also apply to the following cases:

  • you have both desktop and mobile views for a website or web app (e.g. responsive design, etc.)
  • you have a website and a native mobile app that offers similar service/functionality

and as such in both these cases there is shared logic (user/app/site workflow, element locators – even if the actual values differ, but the “logical” representation is the same such as login button on both web site and mobile app, etc.).

Using the techniques defined in that other post, you can share locator references/variables and share page object methods and have a single page object represent both mobile & web versions. For sharing of methods with branching logic, instead of checking which A/B flow to go through, you check what platform you’re on and go to appropriate branch logic based on that.

Also on some specifics, I haven’t tested this type of implementation before, but in theory should work out even for cases where you have website and a native mobile app:

  • You just have to use the right driver instance in the page object methods (or instantiate the page object with the right driver instance), etc. based on the platform (e.g. Appium/ios-driver/etc. vs Selenium WebDriver).
  • For shared locators, XPath may work best, using the multi-valued locator approach with pipes “|”. That is because I know Appium (at least) supports XPath based locators. Not sure about CSS selectors. So, I’m hoping/assuming Appium supports the multi-valued XPath functionality. Don’t know about the other tools lke ios-driver, etc. If this doesn’t work out, you would need separate locator references/variables then.

Some of you might not agree, but this is one way to do it with code reuse via some manageable complexity. The alternative is to have separate page objects with separate methods and locators. That keeps things simpler but give you extra files, extra code, and some redundancy when some of that code and locators are kind of similar. In the end of course, choose whatever works best for you.

iOS mobile testing tips

6 Jun

These tips may be found elsewhere on the web already, I’m just archiving this info I put together a while back into a single repository in the form of a blog post.

Tips for both iOS devices and iOS simulator

Firebug for iOS

Set up a javascript bookmarklet to Firebug Lite, so that you can invoke the lite version of Firebug in mobile Safari on actual device or simulator. See Martin Kool’s article for details, if you don’t know how to set up javascript bookmarklets. NOTE: on simulator, you will lose the bookmark when you do an iOS “Reset Content and Settings…” command. No issue on device unless you specifically delete bookmark or do a factory reset.

View Source of a page

iOS 8+: install an iOS 8 extension like the one called View Source. There are several extensions to choose from. The View Source one may be best as most popular, well known. Or you can also choose the other option for older iOS versions.

iOS 8+, 7.1, and earlier : use this Javascript bookmarklet trick/tip, or this version called Snoopy. NOTE: on simulator, you will lose the bookmark when you do an iOS “Reset Content and Settings…” command. No issue on device unless you specifically delete bookmark or do a factory reset.

Tips for iOS simulator

Set up camera roll to be able to use photos and videos for testing

See: How to import photos into the iPhone Simulator — Aptogo. In general, drag & drop photo into simulator and then tap & hold to save image in simulator will add to camera roll for later use. See the linked article if you need to bulk import photos into simulator. NOTE: on simulator, you may lose the photos when you do an iOS “Reset Content and Settings…” command. No issue on device unless you specifically delete photo or do a factory reset.

For videos, instead of photos, see How do I get video into the iPhone simulator camera roll in iOS 4.2? – Stack Overflow. NOTE: on simulator, you may lose the videos when you do an iOS “Reset Content and Settings…” command. No issue on device unless you specifically delete video or do a factory reset.

Tips for iOS devices

Debugging mobile and tablet websites on iOS – on Windows or locally on device

Tips on mobile and tablet device testing shared usage and remote testing outside corporate network

Sharing bookmarks and photos across devices

If you use an Apple/iCloud account across the devices (This might work on simulator iOS 7/7.1+ if you sign in to iCloud from simulator and then do a Debug > Trigger iCloud sync, although I haven’t tested it):

The photos on each device (if not existing photos, then new photos taken) will be accessible across devices via the Photo Stream section of Photos app. And deleting photo locally in camera roll of a device won’t delete it from the Photo Stream (for that device and all other shared iOS devices), so you have to specifically delete from Photo Stream to delete across devices, the camera roll is treated separately from Photo Stream on each device, so you will notice copies of what you have locally on camera roll also in the Photo Stream that’s available across devices. NOTE: that the Photo Stream (for iOS 6-7.x) is temporary storage, and to make it permanent on each device, you have to save it to local system (device/simulator) before it expires in 30 days (I forget, but the system may copy the photos you’ve previewed to your device after expiration rather than let it disappear from the stream). The iCloud Photo library in iOS 8 is different though with it being permanent storage.

Creating a bookmark on one device will automatically sync (if enabled, by default) them to the other devices using same account, so you don’t have to set up bookmarks/bookmarklets individually on each device.

Recording actions against or test session of iOS physical device into a video

For iOS 8+ only, but see Record your iOS Test Session with QuickTime | Daniel Knott

Tips for simulating iOS device in browser via user agents, etc.

Device screen sizes for testing mobile and tablet views of a site and user agent tools

Tips on mobile and tablet device testing, shared usage, and remote testing outside corporate network

6 Jun

Here’s some useful tips for development and QA testing of websites or apps on mobile/tablet devices, if you didn’t already know.

Tip on wireless network login (accounts) when sharing between people

This tip is for those who use a corporate wireless network that has user accounts per person without a common shared account (or guest access to internal resources).

Rather than ask the previous user for their network login password if/when prompted by the (iOS) device, here’s how to resolve that issue of sharing between users. The tip here is specific to iOS but should be similar for Android, Windows Phone, Windows, Mac, etc.

Option 1 – login with your own network login

You only need to do this if ever prompted to login with only a password (or prefilled username) rather than the whole username & password.

  1. Clear the cached user login info.
    1. Settings > Wi-Fi > find network (name), tap the wifi network’s settings/properties icon (a blue circled arrow on iOS 6, an “i” circled tooltip on iOS 7).
    2. Choose Forget this Network
  2. Find the network (name) again in wifi settings
  3. Select that network. You’ll now be prompted for the login username & password, and not just a password to cached login
  4. If you don’t like “your” login cached, then “forget” the network after using the device.

Option 2 – use other available network but then connect to internal network

This method won’t require you to keep swapping user logins when device shared between people. This only works if you have a wireless access for guests (that perhaps only grants access to internet and some internal resources but not all), or some public wireless access but not corporate wireless access.

  1. Connect to the guest or public wireless network
  2. Connect to internal network using VPN app on the mobile/tablet/device
  3. Disconnect VPN when done testing

Tips on remote testing at home or outside local network

When you’re at home or outside the local network, you don’t have access to internal resources. Here’s some options.

Option 1 – device VPN

Use VPN on the device to connect internally.

Option 2 – shared computer VPN

Use VPN on your computer and route network requests from device through a proxy server running on your computer, assuming both computer & device are on same network. This method allows you to share VPN from computer to device.

Tips on remote debugging of mobile, tablet devices

For Windows, see Debugging mobile and tablet websites on iOS – on Windows or locally on device

For Mac, search the web for iOS remote debugging for details.

Tips on HAR file capture on mobile/tablet devices

For iOS:

For Chrome mobile (Android)?:

Device screen sizes for testing mobile and tablet views of a site and user agent tools

6 Jun

These tips may be found elsewhere on the web already, I’m just archiving this info I put together a while back into a single repository in the form of a blog post.

Table quick reference for device screen sizes

Device Type Screen Size (width x height, in portrait view, landscape = swapped values)
Old iPhones up to iPhone 4S 320×480
iPhone 5 series 320×568
iPhone 6 375×667
iPhone 6+ 414×736
iPad (any model so far) 768×1024


Online references for these screen sizes:

CSS Media Queries for iPads & iPhones | Stephen Gilbert

css3 – iPhone 6 and 6 Plus Media Queries – Stack Overflow

Some desktop browser tools to assist with testing mobile and tablet views of a website (there are more you can lookup yourself)

User-Agent Switcher for Chrome – Chrome Web Store

Window Resizer – Chrome Web Store

User Agent Switcher :: Add-ons for Firefox

Firesizer :: Add-ons for Firefox

Safari has bulit in user agent switcher between iPhone, iPad, and normal Safari desktop. Not sure about resizing window to match user agent though.

Debugging mobile and tablet websites on iOS on Windows or locally on device

13 Jun

I was doing some research and came across these useful tools one can use to debug and analyze mobile/tablet versions of websites/web applications in the case one doesn’t have a Mac handy to do the remote Safari debugging.

Remote Safari debugging on Windows

You can try option of using Telerik AppBuilder (Windows client) as a replacement on Windows for Safari debugger on Mac when remote debugging. There’s a nice blog post about the steps to do it in link below.

The process of using it is much the same as with Safari remote debugging. Have the app open, connect device to Windows via USB, have Safari open on device, then browse device in the app, and open debugger in the app. The tool also will require you to create a Telerik account, and either load/use the default app or create a blank (javascript?) app just to use for debugging mobile Safari on your device.

The tool requires a license or you can use the trial, which becomes a starter edition afterwards. I think the starter edition will still allow you to do the debugging.

NOTE: using this method may require you to have the iOS device drivers to be able to interact with it from AppBuilder. You can get the device drivers by installing iTunes, but if you want to avoid that bloat, you can try to get just the drivers by searching online or downloading iTunes and extracting out the drivers from the installer so you only install the drivers rather than the whole iTunes package, both of which are not covered in this blog post.

Local device debugging on iOS/iPhone/iPad

You can also try these iOS apps below, you can find them in the iTunes App store. They give you built in developer tools like feature (right on iOS, no remote debugging needed) that mobile Safari doesn’t offer. However, they are not the native mobile Safari view/app, though I think it might use the internals of mobile Safari/Webkit to be close enough. These apps are useful when you don’t have a Mac or Windows PC around to do remote debugging with, so you can debug locally on the device through the apps.

MIH Tool – basic edition

HTTPWatch Basic – HTTP Sniffer and Debugger

I gave them a try and they’re at least better than the mobile Safari you get on iOS, unless one needs to target full mobile Safari compatibility. I’m guessing the pro/paid editions of those apps give you more/better features, I confirmed that was the case for HTTPWatch.

Update 7/30/14 – remote Safari debugging that is open source & cross platform

Found this today Works for Linux, Mac, and Windows support eventually to come. I haven’t tested this out myself though. However, except for tinkering with things, cross platform, and open source. I’d say this option is best when working under Linux. On Mac, better to go with the native support from Apple. And for now, Windows is better with the option presented above with an easy GUI for novices.

Update 8/8/2014 – another Safari remote debug for Windows

Adding on previous update, found a Windows port:

Sue Connelly's KIT List Blog

Job Search and Career Management Tips and Strategies

The Networker

Bassem Aly



xlcwu's Blog

Lifestyle, Computer, Ubuntu, Linux, Apple, Mac, iPhone, Game, Programming, Java, C, ObjC and More ...

Multiple States Knowledge Base

Multiple States is a digital design, development and content creation studio, specialising in beautiful, clean and functional websites with powerful content.

journey of quality

make it perfect!

Marc Guillemot's blog

Java, Groovy, HtmlUnit, WebTest, NekoHTML and more. Contact me for rates.

North American Sea Glass Association official website

NASGA is a non-profit organization positively supporting sea glass collectors and the sea glass community with festivals, information, educational opportunities, commercial membership and more. The primary goal of NASGA is to establish a community of informed collectors and sellers of sea glass that are educated on the characteristics and significance of genuine sea glass.

Abiral Shakya's Blog

Learning, Improving and Sharing

Tea in Eighteenth-Century Britain

History of Tea Project at Queen Mary University of London

Phimosis - A Simple Cure (That is working for me)

No nonsense, no adverts, no sales pitch, just honest information.

Glass Onion Blog

Cheat sheets, post-its and random notes from the desk of a programmer

Abode QA

A Hub For Testing Minds...

The Test Therapist

Performance & Security Testing Blog


a programmer's hub

Let's Not Crash and Burn

it makes your brain tingle


“Incinerate Ignorance”

Anastasia Writes

politics, engineering, parenting, relevant things over coffee.

One Software Tester

Trying To Make Sense Of The World, One Test At A Time