Giter VIP home page Giter VIP logo

Comments (14)

xiaocong avatar xiaocong commented on August 20, 2024

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.

gokulakv avatar gokulakv commented on August 20, 2024

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.

xiaocong avatar xiaocong commented on August 20, 2024

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.

gokulakv avatar gokulakv commented on August 20, 2024

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.

xiaocong avatar xiaocong commented on August 20, 2024

You only need to put source code under src folder and jar files under libs folder, and then build.

from uiautomator.

gokulakv avatar gokulakv commented on August 20, 2024

Sure thanks, Cool to work with your tool. Really sincere compliments from our team for this product. Appreciate your awesome work

from uiautomator.

gokulakv avatar gokulakv commented on August 20, 2024

And this handler works only when I add atleast one watcher for it, Why is it so?
Is it a mandate?

from uiautomator.

xiaocong avatar xiaocong commented on August 20, 2024

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.

gokulakv avatar gokulakv commented on August 20, 2024

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.

gokulakv avatar gokulakv commented on August 20, 2024

//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.

xiaocong avatar xiaocong commented on August 20, 2024

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.

gokulakv avatar gokulakv commented on August 20, 2024

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.

gokulakv avatar gokulakv commented on August 20, 2024

So What's the problem/issue?

from uiautomator.

gokulakv avatar gokulakv commented on August 20, 2024

//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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.