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.

Locator strategies and finding elements: Practice

Locator strategies and finding elements: Practice - Selenium Tutorial

From the course: Mobile Testing with Appium

Start my 1-month free trial

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…

Contents