AndroidViewClient | Android ViewServer and ADB client | Automation library
kandi X-RAY | AndroidViewClient Summary
kandi X-RAY | AndroidViewClient Summary
as a pure python tool that automates or simplifies test script creation. It is a test framework for Android applications that: Automates driving Android applications Generates re-usable scripts Provides view-based device independent UI interaction Uses logical screen comparison (UI Automator Hierarchy based) over image comparison (Avoiding extraneous detail issues, such as time or data changes) Supports running on multiple devices Provides simple control for high level operations like language change and activity start Supports all Android APIs Is written in python (python 3.6+ support in 20.x.y+) . |A new Kotlin backend is under development to provide more functionality and improve performance.Take a look at [CulebraTester2] and 20.x.y-series prerelease. | ---|----------------------------------------------------------------------------------------------|.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- Change language
- Finds the view with the given content description
- Open quick settings
- Finds and raises ViewNotFoundException
- Finds view with the given text property
- Opens the Quick Settings bar
- Dump window hierarchy
- List windows
- Traverses the root node
- Connect to adb
- Get the SDK version
- Close the socket
- Mouse button event handler
- Writes the image to a file
- Creates the keycode tab
- Populates the tree tree
- List all windows
- Finds a view by ID or raises ViewNotFoundException
- Performs a drag operation
- Finds view with the specified text property
- Creates the keyboard tab
- Parse command line
- Start the test
- Initializes an element
- Traverses the root of the view
- Initialize the devices
- Event handler
- Plot the histogram
- Save image to file
- Take a snapshot
AndroidViewClient Key Features
AndroidViewClient Examples and Code Snippets
Community Discussions
Trending Discussions on AndroidViewClient
QUESTION
(Edit: the following problem only seems to occur on my Samsung S10e. I just got home and tried Android View Client on a Pixel phone and I'm not having any problem.)
I'm automating the input process for a jetlag calculator android app Entrain. Using the culebra tool, I can find each of the views on the screen. But when I use the ViewClient.touch() method on a view, the program touches the view immediately above it on the screen.
For example, culebra lists these 2 views as the last views on the main menu of the app:
...ANSWER
Answered 2019-Aug-20 at 06:15Unfortunately, I don't have a Samsung S10e to test.
Nonetheless, you may find these tricks useful (I used a Pixel).
The bounds of the views can be obtained running
QUESTION
I have x = 402 and y=201 I need to get text available at that specified coordinates using Androidviewclient can anyone help in solving this issue
...ANSWER
Answered 2018-Sep-28 at 05:19ViewClient.findViewsContainingPoint() method does exactly that, given a Point returns the list of Views containing such Point, which could be more than one.
Then, you can get the text or any other View attribute.
culebra can create a template script for you and then you can edit it and add what you need.
For your case something like this
QUESTION
I use AndroidViewClient
in order to use MonkeyRunner
through Python
. I need to start the AVD
programmatically and get notified when the AVD
start process is completed. How can I catch that event? The execution just does not reach the line after the subprocess.run()
function.
Here is how I start my AVD
:
ANSWER
Answered 2018-Sep-13 at 05:55You can detect that the AVD is ready using
QUESTION
I'd like to compare the screen of my devices (many) so I'm using AndroidViewClient tool to get the hierarchy of my screens with the dump
command in a terminal.
However, my devices are all linked with my computer at the same time, and the dump
command seem to work on only one device. So when I use the command, I get the dump of the first device in the device list when I use adb devices
.
My goal is to compare screens. So what I want is to specify which device I want to use for my dump in the terminal (and then doing it for all my devices to compare).
Is there a solution of this ? because the only solution I found yet is to make an adb -s [device serial_number] shell uiautomator dump
, which offer the possibility to chose which device we want to use among those who are attached, but it produce an xml file (and this is why I need AndroidViewClient's dump, because I don't want the xml file).
In other words, is there a way to specify a device with the dump command in a terminal without disconnecting my USBs successively (keep only one device connected at the same time) ?
Thank you very much in advance !
...ANSWER
Answered 2018-Jun-28 at 06:04If I understand correctly, you want to dump
different devices that are already available through adb
.
Getting help you can see that dump
accepts an optional command line parameter which is the serialno
QUESTION
I have Samsung Android 4.3 API 18 and using AndroidViewClient, the dump produces only android.webkit.WebView therefore it's not possible to get all the id's within this page. How Can I use Culebra to record the actions in the web page ?
...ANSWER
Answered 2018-Jun-12 at 03:50QUESTION
Through the CulebraTester application on my device, I generated some python to simply open the settings application. When I went to run the script, I was greeted with
pkg_resources.DistributionNotFound: The 'androidviewclient<12.4.0' distribution was not found and is required by the application
So then I realized that I didn't have the environment variable set, so I downloaded the project from Github and ran the command
export ANDROID_VIEW_CLIENT_HOME=/path/to/androidviewclient/
I'm confident I did this correctly because I can cd to $ANDROID_VIEW_CLIENT_HOME and view the contents. Now when I go back to run the script this same error appears, so I commented out pkg_resources.require('androidviewclient>=12.4.0') and was then presented with this error
ImportError: No module named com.dtmilano.android.viewclient
Right now I'm clueless about what to do, I tried googling, but I've found nothing to fix the problem. Some-what related I saw a video on youtube where curl was used to run javascript generated by CulebraTester so maybe the same can be done with Python?
...ANSWER
Answered 2017-Dec-04 at 21:04CulebraTester can generate tests in a variety of languages:
- Python
- Java
- Kotlin
- Javascript
- etc.
see Code-Generation-language for details.
Each language has its own dependencies in order to run, for example, if you generate UiAutomator tests in Java you will need the corresponding dependencies in your build.gradle
.
In your specific case, as you have generated Python tests you need androidviewclient
. To install it, follow the instructions on AndroidViewClient: Installation
QUESTION
Trying to use any culebra (AndroidViewClient
) command returns following error:
$culebra -G
Traceback (most recent call last): File "/usr/local/bin/culebra", line 4, in import('pkg_resources').run_script('androidviewclient==13.5.0', 'culebra') File "/usr/lib/python2.7/dist-packages/pkg_resources/init.py", line 739, in run_script self.require(requires)[0].run_script(script_name, ns) File "/usr/lib/python2.7/dist-packages/pkg_resources/init.py", line 1494, in run_script exec(code, namespace, namespace) File "/usr/local/lib/python2.7/dist-packages/androidviewclient-13.5.0-py2.7.egg/EGG-INFO/scripts/culebra", line 1168, in device, serialno = ViewClient.connectToDeviceOrExit(serialno=serialno, **kwargs1) File "/usr/local/lib/python2.7/dist-packages/androidviewclient-13.5.0-py2.7.egg/com/dtmilano/android/viewclient.py", line 2697, in connectToDeviceOrExit device = adbclient.AdbClient(serialno, ignoreversioncheck=ignoreversioncheck, timeout=timeout) File "/usr/local/lib/python2.7/dist-packages/androidviewclient-13.5.0-py2.7.egg/com/dtmilano/android/adb/adbclient.py", line 179, in init self.socket = AdbClient.connect(self.hostname, self.port, self.timeout) File "/usr/local/lib/python2.7/dist-packages/androidviewclient-13.5.0-py2.7.egg/com/dtmilano/android/adb/adbclient.py", line 252, in connect raise RuntimeError("ERROR: Connecting to %s:%d: %s.\nIs adb running on your computer?" % (s, port, ex)) RuntimeError: ERROR: Connecting to :5037: [Errno 111] Connection refused. Is adb running on your computer?
Adb is debinitely running; "adb devices
" lists connected device; "adb push
", "adb pull
","adb shell
", all work fine.
Opening firewall, setting path, reinstalling AndroidViewClient, updating software make no difference.
A previous post "[androidviewclient - Can't connect to the device on vm with port forwarding][1]" concerns very similar error.
His solution (below) does not work for me:
Blockquote
Solved - I changed localhost back to 127.0.0.1 in hosts file and it solves an issue...
Blockquote
Any ideas?
androidviewclient - Can't connect to the device on vm with port forwarding
...ANSWER
Answered 2017-Nov-16 at 07:55Setting default from JDK 1.7 to JDK 1.8 solved this problem. Still getting an error message ("...there are no connected devices"), however since adb devices lists the phone, shouldn't be hard to figure out.
Marking this question solved
QUESTION
I have an AndroidViewClient script that is testing an activity. Clicking a button in my android app creates a new Activity instance. It seems like the ViewClient instance in my python script needs to be recreated after the new activity is launched - is that right? Something like this:
...ANSWER
Answered 2017-Jul-28 at 17:19No, there's no need to create a new instance, all you have to do every time the screen changes (whether it's a new Activity or the same one) is to call
QUESTION
I have a button which launches a new Activity. Is there an API in AndroidViewClient to get the package and name of the current activity? Something like:
...ANSWER
Answered 2017-Jul-18 at 18:15This prints the top Activity and package
QUESTION
Is there any documentation on AndroidViewClient covering public classes, methods, and syntax?
...ANSWER
Answered 2017-Jun-13 at 21:27It is in the doc directory of the project.
You have to clone or download the project to view it properly in your browser as github's web interface will show the source code instead.
UPDATEjthurner found a way, I didn't know existed, of showing the docs over github pages. You can now view the documentation online at API Documentation.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install AndroidViewClient
You can use AndroidViewClient like any standard Python library. You will need to make sure that you have a development environment consisting of a Python distribution including header files, a compiler, pip, and git installed. Make sure that your pip, setuptools, and wheel are up to date. When using pip it is generally recommended to install packages in a virtual environment to avoid changes to the system.
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page