android-uiautomator

Any faster way to dump UI hierarchy?

别来无恙 提交于 2021-02-17 22:23:08
问题 Right now I'm using uiautomator do dump the UI like this: adb shell uiautomator dump And it works fine except that it takes around 3 seconds to perform it. So I wonder if there is a faster way to do it? Like creating a service that dump the UI or will it take just as long? 回答1: Guess I should answer my own question as I found a better way to do it. I found this project that use uiautomator togheter with a light weight rpc server so you can send commands to the device: https://github.com

Create Unit and Instrumentation test for Android project with dynamic features

喜你入骨 提交于 2021-01-29 19:47:42
问题 I have a project where I have main :app package. Besides that, the app contains of two dynamic features inside the same package, :features:A and :features:B. The issue here is that I can't run Unit and Instrumentation tests (Espresso, UI Automator) because of the following error(s): “AAPT: error: resource string/app_name (aka com.app.A.test:string/app_name) not found.” When I run tests(UI tests in this case) App compiles and works without any issues. I figured out that error occurs on

How to access the clipboard on android device

我与影子孤独终老i 提交于 2021-01-27 14:28:11
问题 My initial issue is being able to click a "PASTE" bubble that pops up when the a click is being held on a text field. Currently I have not found a way to get that action to happen using uiautomator script/code. So I started looking at directly accessing the clipboard. Now I am having issues accessing the clipboard on the android device. We are not using an app (apk), but are pushing a jar to the device and then using adb runtest to run the classes. So no activities are being started. I am

UiAutomator — Add Widget to Home Screen

我只是一个虾纸丫 提交于 2020-06-25 21:03:12
问题 I have a fair amount of experience with Google's uiautomator; however, I seem to be stumped when it comes to adding a widget to the phone's home screen. For now lets keep it simple and assume the screen the widget is being added to is empty. The thought process would be to open the app drawer > click the widgets tab > locate the widget to be added > long click and drag the widget to the home screen. It seems like widgets are not "long clickable" though. Any thoughts/suggestions/solutions will

How do i select value from dropdown of a hybrid app using appium?

馋奶兔 提交于 2020-03-03 12:17:28
问题 I am relatively new to appium, and is actively involved in a poc. The requirement is to select a value from the drop down, however i am able to click the spinner element but anything below that is not getting recognized my uiautomator. as a result i am not able to select any values from the spinner element. I am attaching the code block of the script and also the element tree snapshot. //trying to click the dropdown list try{ WebElement parentElement1 = driver.findElement(By.id("retProdOp0"))

Quick Setting through UIAutomator

一个人想着一个人 提交于 2020-01-16 00:45:54
问题 I am trying to access one of the item in "Quick Settings" through uiautomator. I am able to open the quick setting through device.openQuickSettings(); After this, I am unable to get to a particular item for example WiFi / Airplane mode. Could some body help me to select an item in this quick settings? I tried the following if (new UiObject(new UiSelector().text("BRIGHTNESS")).exists()) { new UiObject(new UiSelector().text("BRIGHTNESS")).click(); } and if (new UiObject(new uiSelector()

UIAutomator - How to click the menu item

穿精又带淫゛_ 提交于 2020-01-15 06:11:42
问题 I have automated go to setting in android phone using UI Automator and i clicked the menu using "getUiDevice().pressMenu();" and its opened menu with 3 sub menu item and i want to click the second menu by using name or index or id , please help how to click the sub menu in Android UIAutomator ? 回答1: This overflow menu icon ImageView with the three dots has no id ... but one can get it by it's description: UiObject2 menuButton = this.mDevice.findObject(By.desc("More options")); /* open the