Finding elements for iOS web-based apps using Safari's Develop option
Safari comes with a built-in solution for finding the elements for web apps, but we need to perform the following steps in order to set up the device for remote debugging:
- Navigate to Settings | Safari | Advanced:
- Then, turn on Web Inspector:
- Open the Safari browser on your device/simulator and navigate to the desired URL (we are navigating to www.google.com).
- Now, go to your Mac Safari browser, click on the Develop option from the menu, select the device/simulator (assuming that the device is connected to your Mac), and click on the URL:
- Now you will get the following screen with the HTML source code:
Now, we can easily inspect elements with Safari DevTools.
Finding elements by ID
To interact with the web page, first we need to find an element on the page. All the functions of the Appium client library need an element to perform the actions on the web page.
Finding an element by ID is used to locate only one element in the...