课程: Mobile Testing with Appium

今天就学习课程吧!

今天就开通帐号,24,700 门业界名师课程任您挑!

Element discovery: Getting app source

Element discovery: Getting app source - Selenium教程

课程: Mobile Testing with Appium

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.…

内容