![]() This is what we gonna see in this session. Defining each Locator directly as a “MobileElement“ with the help of Page Factory. Public static By loc_login_btn = MobileBy.AccessibilityId("login_button") ĭriver.findElement(loc_Username).sendKeys("Admin") ĭriver.findElement(loc_Password).sendKeys("Admin123") ĭriver.findElement(loc_login_btn).click() Ĥ. Public static By loc_Password = MobileBy.AccessibilityId("password") Public static By loc_Username = MobileBy.AccessibilityId("username") Defining the Locator using “By” variable (‘By’ from selenium or ‘MobileBy’ from Appium using POM) Defining the Locator and Locator strategy as a “String” variableĭriver.findElement(MobileBy.AccessibilityId(loc_Username)).sendKeys("Admin") ĭriver.findElement(MobileBy.AccessibilityId(loc_Password)).sendKeys("Admin123") ģ. Without defining the Locator and Locator strategy as a variable seperately, instead directly implementing the locator in driver.findElement() method.ĭriver.findElement(MobileBy.AccessibilityId("username")).sendKeys("Admin") ĭriver.findElement(MobileBy.AccessibilityId("password")).sendKeys("Admin123") ĭriver.findElement(MobileBy.AccessibilityId("login_button")).click() Ģ.For this I can go with 4 types of approaches, Using the above method, my intension is to verify login functionality using a valid username and Password. Imagine, I have a Login test case to be executed and using POM I have a Login class which is having the below method, Let me show an example of POM and Page Factory for better understanding, Page Factory is also same like POM but in addition it comes with lot of predefined notations and attributes to help the automation tester to initiate or declare an element in more standard and robust way. Declaring a Page and page objects/elements in our java class. We all knows that POM is a pattern or style in other words it acts like a “Object Repository” i.e. Now we are taking our next step in the ladder that is “Page Factory”. In our previous blog we have seen how to create a POM and with the help of POM and TestNG we executed our first test case in our Appium automation framework. How to Run TestNG Class from Command Line and Eclipse How to create and run TestNG project through Testng.xml How to write Selenium WebDriver Test with TestNG – Maven Project ![]() How to Create TestNG Class with Different Annotations
0 Comments
Leave a Reply. |