From the course: Mobile Testing with Appium

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Element discovery: Getting app source

Element discovery: Getting app source - Selenium Tutorial

From the course: Mobile Testing with Appium

Start my 1-month free trial

Element discovery: Getting app source

- [Man] Earlier in the course we showed how to automate a login screen using Appium. I've got that code, loaded up now as chapter four, six page source before dot Java. You might recall that we're finding elements primarily by accessibility ID. You can see, for example, down here in our test method, that we're finding an element using a username selector here and another one using a password selector here. But how do we know that these selectors are correct for our app? Earlier you had to just take my word for it and now we'll explore one way to check for ourselves, using a special driver method called get page source. Even though mobile apps are not webpages, Appium can give you an XML representation of the UI hierarchy, including lots of interesting information about particular elements on-screen. We can call the get page source method anytime we want and we'll get back an XML string showing us everything Appium can see about the app, at that point in time. So let's give this a try.…

Contents