Comments (14)
Hi @gokulakv,
It's not a good idea to take screenshot in watcher. The common way is to do it using test framework. e.g. if you are using nosetest, you can write a plugin to do it. Next is an example on its official website:
HTML Output Plugin. You can write your code to take screenshot on addError
and addFailure
methods.
Another way I am trying is to capture ui-not-found exception surround any device operation. You can look at the code at not-found-callback branch (not released). Next is sample code:
def my_call_back():
d.screenshot('/path/to/screenshot.png') # take screenshot here
return True # True means not to call next callbacks
def setup_func():
d.handlers.on(my_call_back)
def teardown_func():
d.handlers.off(my_call_back)
@with_setup(setup_func, teardown_func)
def test_demo():
'''my test...'''
Hope this can help you out.
-Xiaocong
from uiautomator.
Okie, what's the purpose of bundle.jar and uiautomator-stub.jar?
If I want to change Server code, how to compile these two jars myself?
from uiautomator.
bundler.jar
is a bundle of all necessary libraries under libs directory. uiautomator-stub.jar
is compiled from source code under src.
To compile it, you must follow the step on Readme#Build.
from uiautomator.
Oh is it good to include our own libraries into your source and use it for ourselves?
Our plan is to use quicksettings (UI) libraries written for our test-cases, into JSONServer, so to use in uiautomator.py and inturn in testcases, as we are not able to use both UI instance in SL4A and this Py UIAutomator
from uiautomator.
You only need to put source code under src
folder and jar files under libs
folder, and then build.
from uiautomator.
Sure thanks, Cool to work with your tool. Really sincere compliments from our team for this product. Appreciate your awesome work
from uiautomator.
And this handler works only when I add atleast one watcher for it, Why is it so?
Is it a mandate?
from uiautomator.
And this handler works only when I add atleast one watcher for it, Why is it so?
Is it a mandate?
No. I received a lot of request for how to define customized watcher, so I added handler. It is only a PC side implementation to replace Watcher and can be used without watcher. I assume what you met is a syntax error...
from uiautomator.
No no, I clearly ran with and without Watcher,
This Handler runs only when there is atleast a dummy watcher, Observed Multiple times
P.S. There is no Syntax error came while running this, other than the Initial One to use self.my_callback
from uiautomator.
//It's not a good idea to take screenshot in watcher
What in this case when I want to capture Screenshot of Obstacles that are suppressed using Watchers?
from uiautomator.
Could you please run below code in your PC, and check if you can see callback....
in console?
from uiautomator import device as d
def my_call_back(device=None):
print 'callback....'
return True # True means not to call next callbacks
d.handlers.on(my_call_back)
d(text='Not Found').click()
from uiautomator.
NO I can't see callback.... in the console
And
//return True// statement
raised the following:
SyntaxError: 'return' outside function
SO COMMENTED this STATEMENT
from uiautomator.
So What's the problem/issue?
from uiautomator.
//It's not a good idea to take screenshot in watcher
When I want to capture Screenshot of Obstacles that are suppressed using Watchers?
I need to add Watcher with Screenshots rite?
from uiautomator.
Related Issues (20)
- Clip board
- some code of uiautomator was removed after upgraded to 1.0.1 from 0.3.6
- Change from "-r -t" to "-r", "-t" required to connect to device on windows.
- does python uiautomator support android force desktop mode on android 11 ?
- GrantPermissionRule in uiautomator
- poco ui元素当页面位置发生变化后,点击的位置不正确
- How can I integrate vision based logic such that I can tap/swipe based on visual match instead of UI element ?
- No connection could be made because the target machine actively refused it HOT 1
- uiautomator is not workable in android S, how can I get the source code of stub, so that have chance to upgrate it. HOT 1
- curl: (7) Failed to connect to localhost port 9008: Connection refused
- DexArchiveBuilderException when using version 1.6
- Getting error code -32001
- LongClick does not seem to work HOT 2
- Automate android HOT 1
- sometimes, click() returned False. HOT 2
- Error while trying to use uiautomator modules HOT 1
- Check out this module for Android 13
- python3.7.9 uiautomator脚本一直阻塞无法执行 HOT 1
- Need to install the uiautomator everytime when running HOT 2
- '.exists' calls timing out or taking a LONG time to complete if I have a field on screen with constantly updating text HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from uiautomator.