Using Selenium Webdriver Selectors in Appium ios

不打扰是莪最后的温柔 提交于 2019-12-02 06:46:47

You can create one object repository file which contains the locators for both WebApp and iOS app. Then you have to follow the below process

  1. Create WebDriver and AppiumDriver instances
  2. Use the relevant drivers for locating the elements in WebApp as well as iOS app. We can use both the drivers within a test case.

Please note that, the way WebDriver and AppiumDriver identifies the elements will be different. For example, in WebDriver if an element is identified by using ID then similarly in AppiumDriver an element can be identified by using the findElementByAccessibilityId.

Even though AppiumDriver uses the same logic which WebDriver uses, the method names will differ. Please find the link for all the methods used by AppiumDriver

Hope this helps.

How about creating multiple object repositories and loading the relevant object repository based on the underlying platform?
1. So you need to store locators of both the platforms in separate repositories
2. Create a Interface / wrapper which would load relevant repository based on the platform on which tests are going to run.

Didn't quite get the question but for Appium You have separated annotations for bot iOS and Android platform similar as for web via:

@FindBy(id="buttonOK")
private WebElement buttonPopUp;

Here is example for Android and iOS

@iOSFindBy(id = "lets_do_it")
@AndroidFindBy(id = "message_popup_dismiss_button")
@WithTimeout(unit = TimeUnit.SECONDS, time = 1)
private MobileElement buttonPopUp;

So in same pageObject you have covered both platforms.

Mobile platform can work together, but recommendation is not to mix web and mobile, but mobile platforms can play together just fine, and is recommended so can share same code functionality.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!