课程: Mobile Testing with Appium

今天就学习课程吧!

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

Locator strategies and finding elements: Practice

Locator strategies and finding elements: Practice - Selenium教程

课程: Mobile Testing with Appium

Locator strategies and finding elements: Practice

- [Instructor] For this practical video, I've made sure that I have an Appium server running as well as my Android emulator. Now let's have a look at the code. I'll switch to IntelliJ and the code example we're starting with here is chapter_4_2_Locator_Strategies_Before.JAVA. We're starting with the same code we ended with earlier to start and stop in Appium session. The only thing I've changed is I've added a static, thread.sleep in the setup method to make sure our app has fully loaded before we try and find an element. Using thread.sleep for this purpose is not a good practice but it helps us focus on what's important for now which is playing with the find element method. With this script we're going to upgrade our test method by removing the print statement and adding the find element API call to find the element that for our test tab we'll get us to the login screen. Now I happen to know that this element has an accessibility ID of login screen. So that's a strategy and selector…

内容