android-uiautomator

UIAutomator - How to click the menu item

廉价感情. 提交于 2020-01-15 06:10:49
问题 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

UiAutomator changing variables

心不动则不痛 提交于 2020-01-10 05:55:31
问题 I've got a test case that accesses the browser and does some stuff with it. But I need to programmatically change what the inputs are for some of the text boxes. I have 8 strings and a boolean value that the test needs the run properly. The problem is, is that you have to run the test case through ant and the build process before you can actually run it. I'd love to be able to build this, put it on the device and then somehow pass the data to the device when I call it. But I don't know if

How to handle toast generate in android device while automating an app using appium?

懵懂的女人 提交于 2020-01-05 07:57:19
问题 I am trying to automate an android app using Appium and Webdriver. When i give invalid credentials to login into the app a toast appears, i want to assert the text of this toast.Also, I can't capture the screen shot of this toast using android uiautomatorviewr. How can i handle toast in android? Any Idea!! 回答1: Yes it is possible but only using uiautomator2, just pass the argument in the capability and use the below code: DesiredCapabilities caps = DesiredCapabilities.android(); caps

Android UiAutomatorViewer can't detect some Views

喜夏-厌秋 提交于 2020-01-03 15:34:47
问题 I'm having problems with UIAutomatorViewer with my app. If you look at the screenshot, the highlighted View is supposed to be a FrameLayout with a child TextView, but you do not see that. The activity has the following xml: <!-- A DrawerLayout is intended to be used as the top-level content view using match_parent for both width and height to consume the full space available. --> <android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools=

How to install and run appium in linux?

元气小坏坏 提交于 2020-01-03 06:20:51
问题 I want to do UI automation for opening an url in a real android device. For that I want to install and run appium on my linux system, please guide me how to do? Also suggest me Is there anyway to open an url in chrome browser using eclipse?? 回答1: Install appium on Linux 18.04 If you have node.js installed you can try : sudo npm install -g appium --unsafe-perm=true --allow-root it worked for me. 回答2: I guess all the information you need to run Appium in Linux is in this here: http://appium.io

How to install and run appium in linux?

会有一股神秘感。 提交于 2020-01-03 06:20:00
问题 I want to do UI automation for opening an url in a real android device. For that I want to install and run appium on my linux system, please guide me how to do? Also suggest me Is there anyway to open an url in chrome browser using eclipse?? 回答1: Install appium on Linux 18.04 If you have node.js installed you can try : sudo npm install -g appium --unsafe-perm=true --allow-root it worked for me. 回答2: I guess all the information you need to run Appium in Linux is in this here: http://appium.io

UiAutomator getLastTraversedText()

*爱你&永不变心* 提交于 2020-01-02 02:24:05
问题 I was trying to test an Android Webview using Android UiAutomator. As I understand the documentation, scrolling through a WebvView would generate UI traversal events, and those should be readable via getUiDevice().getLastTraversedText(). However, when I use getUiDevice().pressDPadDown() to scroll through a web view, getUiDevice().getLastTraversedText() keeps returning null. What have I missed? If anyone has gotten this call to work I would very much appreciate a short code sample. 回答1: Bad

Testing Notifications in Android

女生的网名这么多〃 提交于 2020-01-01 05:20:14
问题 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 ? 回答1: Testing Notification using UIAutomator: Just go through the below code. It will help you in testing the notification. UiDevice device = UiDevice.getInstance

How do I debug UIAutomator scripts with Eclipse

泪湿孤枕 提交于 2020-01-01 03:17:09
问题 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? 回答1: 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

Uiautomator “am start”

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-30 04:58:09
问题 Does any body know how to call am start -a ACTIVITY from uiautomator code. Or is it possible to start activity right from junit code. 回答1: Here's an example I use to start an activity from the .jar file: private boolean startSettings() { try { Runtime.getRuntime().exec( "am start -n com.android.settings/.Settings"); sleep(1000); } catch (IOException e) { e.printStackTrace(); } for (int i = 0; i < 5; i++) { sleep(1000); if (getUiDevice().getCurrentPackageName().contains( "com.android.settings"