简体   繁体   English

关于Android上的Appium自动化的问题

[英]Questions on Appium Automation on Android

questions: 问题:

1.App does not have any Content-desc,what should i be using in this case? 1.App没有任何Content-desc,在这种情况下我应该使用什么? to call the element ex: There is a button,and need to tap on that button when i inspect the element from UIautomator tool,it does not have any content in content-desc, what else can i considere best way to identify that element 调用元素ex:有一个按钮,当我从UIautomator工具检查元素时需要点击该按钮,它在content-desc中没有任何内容,还有什么我可以认为是识别该元素的最佳方法

Ex: Resource-id : au.com.carsguide:id/search_btn Content-desc - blank 例如:Resource-id:au.com.carsguide:id / search_btn Content-desc-空白

If i use Resource-id, the appium does not picks that value, it has to be only "search_btn" then it picks the value, why is resource-id not supported with complete package name? 如果我使用Resource-id,appium不会选择该值,它只能是“ search_btn”,然后它将选择该值,为什么完整的程序包名称不支持resource-id?

  1. What is the difference b/w AndroidDriver and RemoteDriver, which one should i be using, If using RemoteDriver is like do we need to run the selenium server? 黑白AndroidDriver和RemoteDriver有什么区别,我应该使用哪一种?如果使用RemoteDriver就像我们需要运行Selenium服务器?

3.I am able to run the appium automation on the actual device, can any one help me in running the automation on android emulator? 3.我能够在实际设备上运行appium自动化,有谁能帮助我在android仿真器上运行自动化? how to do that? 怎么做?

Below error is seen when used AndroidDriver: 使用AndroidDriver时看到以下错误:

FAILED CONFIGURATION: @BeforeClass setUpBeforeClass
java.lang.Error: Unresolved compilation problems: 
The return types are incompatible for the inherited methods    FindsByAccessibilityId<WebElement>.findElementsByAccessibilityId(String),   AppiumDriver<RequiredElementType>.findElementsByAccessibilityId(String)
The return types are incompatible for the inherited methods   FindsByCssSelector.findElementsByCssSelector(String),   AppiumDriver<RequiredElementType>.findElementsByCssSelector(String)
The return types are incompatible for the inherited methods  WebDriver.findElements(By), AppiumDriver<RequiredElementType>.findElements(By)
The return types are incompatible for the inherited methods  FindsById.findElementsById(String),  AppiumDriver<RequiredElementType>.findElementsById(String)
The return types are incompatible for the inherited methods  FindsByLinkText.findElementsByLinkText(String),  AppiumDriver<RequiredElementType>.findElementsByLinkText(String)
The return types are incompatible for the inherited methods  FindsByXPath.findElementsByXPath(String),  AppiumDriver<RequiredElementType>.findElementsByXPath(String)
The return types are incompatible for the inherited methods  FindsByName.findElementsByName(String),  AppiumDriver<RequiredElementType>.findElementsByName(String)
The return types are incompatible for the inherited methods  FindsByTagName.findElementsByTagName(String),  AppiumDriver<RequiredElementType>.findElementsByTagName(String)
The return types are incompatible for the inherited methods  FindsByLinkText.findElementsByPartialLinkText(String),  AppiumDriver<RequiredElementType>.findElementsByPartialLinkText(String)
  1. Less is good. 少即是好。 Why do you want to access id with package name ? 为什么要使用包名访问ID? By the way you have specified package name in capabilities so appium uses id with package name internally to locate application components. 顺便说一下,您已经在功能中指定了程序包名称,因此appium在内部使用ID和程序包名称来查找应用程序组件。 If component belongs to other app then you need to provide id with its package name. 如果组件属于其他应用程序,则需要提供ID及其包名称。

  2. You don't need to run selenium server, you need to run Appium Server. 您无需运行Selenium服务器,而需要运行Appium Server。 AndroidDriver extends Abstract AppiumDriver which extends DefaultGenericMobileDriver (this is also abstract) again this abtract class extends RemoteWebDriver. AndroidDriver扩展了抽象AppiumDriver,它又扩展了DefaultGenericMobileDriver(这也是抽象的),该抽象类扩展了RemoteWebDriver。

So AndroidDriver has more APIs/functions than RemoteWebDriver. 因此,AndroidDriver比RemoteWebDriver具有更多的API /功能。 So you can choose AndroidDriver. 因此,您可以选择AndroidDriver。

    • You can use Genymotion emulator 您可以使用Genymotion模拟器
    • When emulator is run perform command adb devices in terminal to get emulator id 运行模拟器时,在终端中执行命令adb devices以获取模拟器ID
    • Use emulator id 192.168.56.101:5555 for deviceName and udid appium capabilities 将模拟器ID 192.168.56.101:5555用于deviceNameudid appium功能

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM