android-uiautomator

Unable to start uiautomatorviewer

試著忘記壹切 提交于 2019-12-05 01:25:21
I have : Android SDK Tools, Revision 22 Android SDK Platform, API 18 I go to <android-sdk>/tools/ , I see there is one file named " uiautomatorviewer ", I execute command uiautomatorviewer from terminal under the above path, however I got the following message: uiautomatorviewer: command not found why? Because your tools/ directory is not in your PATH . Either use ./uiautomatorviewer or add tools/ (and probably platform-tools/ to your PATH . Note that this has nothing to do with programming and everything to do with your *nix-style OS (Linux, OS X, etc.). Please note that uiautomatorviewer

Multiple devices connected error in Robotframework

我的未来我决定 提交于 2019-12-04 19:48:33
I am using Robot Framework with UI-Automator for automating Native Android application. In my current instance I have connected two devices to my PC- one for my general testing work and in the second device, I am running Automation. I have given serial of the device while running the test cases. But I am getting following error in the console: EnvironmentError: Multiple devices attached but default android serial not set can somebody help me what I need to do. The answer is on the documentation for the Set Serial keyword, on uiautomatorlibrary.html , below: Set Serial android_serial Specify

Build UiAutomator 2.0 from command line

本秂侑毒 提交于 2019-12-04 13:49:27
问题 I want to build, install and run the tests of a UiAutomator project through the command line. In the previous version I was doing: android create uitest-project -n <project_name> -p <project_path> -t <target_id> ant build to build and then adb push <jar_path> /data/local/tmp to install and finally adb shell uiautomator runtest <jar_name> -c <main_class> However, right now I'm stuck in the building part . The result is -check-env: [checkenv] Android SDK Tools Revision 24.1.2 [checkenv]

Testing Notifications in Android

孤街浪徒 提交于 2019-12-04 07:26:36
My android app has a service which sends notifications to user based on parameters like number of runs of the app. The notifications are sent at different times in different situations. I want to test whether notifications are sent at the right times in all the different cases. Does android provide a way of such a testing ? Prem Choudhary Testing Notification using UIAutomator: Just go through the below code. It will help you in testing the notification. UiDevice device = UiDevice.getInstance(InstrumentationRegistry.getInstrumentation()); device.openNotification(); device.wait(Until.hasObject

UI Automator Viewer: receiving “Error taking device screenshot: null” every time from AVD device

主宰稳场 提交于 2019-12-04 03:52:35
This only happends on the AVD devices within the AVD manager. I never get this error when capturing uiautomatorviewer screenshots from Genymotion. When attempting to capture within the Android Device Monitor in AS...it gives me a little more detail: Reason: Error obtaining UI hierarchy Try it with HAXM acceleration turned off, if you can. I had to run the test using a profile that then ran the test on a physical device to get the screen shots. Essentially, if the AVD has Use GPU or Snapshot selected - even if running on a USB attached device, screenshots fail. This is a bug in uiautomator

Writing tests for an android app that logs into Facebook: UIAutomator can't fill in text in Facebook's username field

主宰稳场 提交于 2019-12-03 22:46:00
From this question/answer I got the idea to use UIAutomator to test my app that requires logging into Facebook. Writing tests for an Android app that logs into Facebook I tried UiObject2 editText = mDevice.findObject(By.clazz("android.widget.EditText")); editText.setText("test@email.com"); As well as other things but whatever I do I can't get it to fill out the field. I used hierachyviewer tool to see that it was an EditText. It's a webview, though, so I don't know. Is this possible? My full test code class is attached below: package com.greenrobot.yesorno.test; import android.os.SystemClock;

How can I get the parent of a view using uiautomator?

血红的双手。 提交于 2019-12-03 19:21:22
问题 I'm trying to identify the parent view of an ui element so I can navigate through the UI freely. For example, in Settings app, I can find the view with the text "Bluetooth": UiObject btView = new UiObject(new UiSelector().text("Bluetooth")); Now, the part where I get stuck is this one: I want to navigate two levels up and start a new search for the on/off button that enables and disables bluetooth. Note: I can get the button if I use the code below. UiObject btButtonView = new UiObject(new

How to access elements on external website using Espresso

坚强是说给别人听的谎言 提交于 2019-12-03 12:53:27
Using espresso, we click a Login button which launches an external website (Chrome Custom Tab) where you can login and then it redirects back to our android application. Is there a way in Espresso to: 1) Verify the correct URL is being launched 2) Access the elements on the website so that I can enter the login information and continue to login When I try viewing it in the Espresso Launch Navigator, nothing shows up for the page, and if I try to record, it doesn't pick up on me entering anything on the page. This is what I have so far (it is in Kotlin (not Java)): And here is the error that

java.lang.SecurityException: Permission Denial: getIntentSender() when using UiAutomation in a test

时间秒杀一切 提交于 2019-12-03 11:21:32
Whenever I try to use UiAutomation in any test through getInstrumentation().getUiAutomation() , the process crashes with this exception: java.lang.SecurityException: Permission Denial: getIntentSender() from pid=30334, uid=2000, (need uid=1000) is not allowed to send as package android at android.os.Parcel.readException(Parcel.java:1540) at android.os.Parcel.readException(Parcel.java:1493) at android.app.IUiAutomationConnection$Stub$Proxy.disconnect(IUiAutomationConnection.java:225) at android.app.UiAutomation.disconnect(UiAutomation.java:240) at android.app.Instrumentation.finish

How do I debug UIAutomator scripts with Eclipse

你。 提交于 2019-12-03 08:33:53
From what I can see, when a UIAutomator script is compiled into a jar file and it gets run by using the adb shell command. I can see that there is a -e debug command line option which waits for a debugger to connect before starting but how do I connect this to the debugger from Eclipse so I can debug my UI Automator script? neodymium I've worked it out. The process is a little long winded but it works! The key to this is understanding how to use the Dalvik Debug Monitor Server (DDMS) and understanding remote debugging with Java and Eclipse. In brief follow the following steps: Set up a DDMS