在 Appium ios 中使用 Selenium Webdriver Selectors [英] Using Selenium Webdriver Selectors in Appium ios

查看:28
本文介绍了在 Appium ios 中使用 Selenium Webdriver Selectors的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在进行的一个项目是在开发一个 ios 应用程序的同时开发一个 web 应用程序(为了同样的事情),我希望能够使用现有的 Selenium 测试,但我们在选择器方面遇到了问题.是否有可用于 Selenium Webdriver 和 Appium ios 的选择器类型或属性名称,以便我可以将变量设置为浏览器或应用程序,并且它们在两者上运行和工作.这个项目之前没有人使用过Appium,所以我们缺乏很多知识.

A project I'm on is developing a web app at the same time as an ios app (for the same thing) and I'm hoping to be able to use existing Selenium tests, but we're having trouble with selectors. Is there a selector type or attribute name that can be used for both Selenium Webdriver and Appium ios, so that I can just set a variable to either browser or app and they run and work on both. Nobody on this project has used Appium before, so we are lacking a lot in knowledge.

我试过用ID,发现ios不能用,改了名字,发现名字已经从appium中删除了.如果可能,我们更愿意使用浏览器中与应用中相同的选择器.

I tried using IDs and found that ios doesn't work with them, changed to names and found that names have been removed from appium. If possible we'd prefer to use a selector that will be the same in the browser as it is in the app.

谢谢

推荐答案

您可以创建一个对象存储库文件,其中包含 WebApp 和 iOS 应用程序的定位器.然后你必须按照下面的流程

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. 创建WebDriverAppiumDriver 实例
  2. 使用相关驱动程序定位 WebApp 和 iOS 应用程序中的元素.我们可以在一个测试用例中同时使用这两个驱动程序.

请注意,WebDriverAppiumDriver 识别元素的方式会有所不同.例如,在 WebDriver 中,如果一个元素是通过使用 ID 来标识的,那么在 AppiumDriver 中类似的一个元素可以通过使用 findElementByAccessibilityId 来标识.

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.

即使 AppiumDriver 使用与 WebDriver 相同的逻辑,方法名称也会有所不同.请找到链接,了解<代码>AppiumDriver

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

希望这会有所帮助.

这篇关于在 Appium ios 中使用 Selenium Webdriver Selectors的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆