When using Selendroid to test mobile web application on mobile devices or mobile simulators, identifying web elements are very important. Without correct element identification, Selendroid mobile web driver cannot find elements in the test automation application. This article shows you how to use Safari User Agent to view mobile web application and identify web elements by using web elements inspector.
Test Case: verify that users are able to search merchandise on Ebay mobile web site.
Step 1: navigate to http://m.ebay.com
Step 2: type in android in the search box
Step 3: click on search button or press enter.
Step 4: assert that the website returns number of android merchandises.
1. Open Safari browser and type in "http://m.ebay.com". Since there is no User Agent defined on Safari Browser, this site navigates to desktop version of Ebay site.
2. Press "Alt +F" button to fire up the menu, choose Develop ->User Agent->Safari iOS 4.3.3 - iPhone; this site navigates to Ebay mobile site.
3. Right click on the search box and choose "Inspect Element".
4. In the Elements section, you can find the element identification that you will be using in the test. For example:
Search text box: id="kw" or name="kw".
Search button: span.srchBtnLg
Watch the full video here