How to inspect the web elements in the Safari mobile web browser – iOS?

In order to automate the mobile web application running in the iOS specific safari mobile web browser using the Appium, we need to inspect the web elements available in the mobile web browser. Web elements information should be captured and utilised in the automation scripting part associated with the development IDE such as Eclipse.

We are going to use the Safari Develop menu available in the Mac and the iOS simulator or real device browser will sync with the Mac develop menu to identify the required web element information as follows;

Prerequisite in Mac;

1. Open the Safari browser in Mac

2. Go to ‘Preferences’ under the ‘Safari’ tab

3. Go to Advanced Tab in the opened window

4. Select the checkbox of ‘Show Develop menu in menu bar’ as mentioned in the below screenshot

5. Now, you could see ‘Develop’ menu in the safari web browser

1_develop_menu

Prerequisite in iPhone or iOS Simulator;

In this post, I’ve used the iOS Simulator for inspecting the web elements.

1. Go to the ‘Safari’ under the ‘Settings’

2. Go to Advanced option (scroll down if you are using iOS simulator)

3. Enable the Web Inspector option as mentioned in the below screenshot

2_web_inspector_option

Please open the mobile web application in the Safari mobile web browser available in the iPhone real device or iOS simulator as mentioned below;

Example: https://www.india.ford.com

3_mobile_web

 

Now, Go to the Safari browser in the Mac and select the ‘Develop’ menu. Select the ‘Simulator’ option under the ‘Develop’ menu and you could see the mobile website address as mentioned in the below screenshot;

4_website_address

Select the website address and you could see the web inspector window in the Mac as mentioned below;

5_web_inspector_window

Now bring the iOS simulator safari browser window and web inspector window each other, select the required web elements in the mobile web browser window as mentioned in the below screenshot;

After selecting the ‘start element selection’ icon, you could see the icon colour changed from Grey to Blue;

6_select_web_element

Select the required web element in the safari mobile web browser using the ‘start element selection’ icon and its information will be displayed in the web inspector window as specified in the below screenshot;

7_simulator_inspector

 

8_element_information_copy

Happy Scripting!!!

One thought on “How to inspect the web elements in the Safari mobile web browser – iOS?

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s