Git Product home page Git Product logo

Comments (9)

xiaocong avatar xiaocong commented on August 20, 2024

There are several ways:

  • Use adb -s SLAVE_SERIAL shell am start with Intent.ACTION_CALL to make a call to the master device. Python has a lot of modules can do the system call.

  • If you want to use uiautomator instead of am, you can write code like below (not yet released, the code is in develop branch):

    from uiautomator import Device
    slave = Device("SLAVE_SERIAL")
    master = Device("MASTER_SERIAL")
    some_method_to_make_call(slave)
    some_method_to_receive_call(master)
    

    If needed, you can make the two methods async or sync.

  • Another choice is to use cloud voice API like http://plivo.com/. I didn't try it :(

from uiautomator.

satishsn1 avatar satishsn1 commented on August 20, 2024

Hi Xiaocong,

When are you releasing the code for connecting two devices using device consturctor passing the id of devices.
from uiautomator import device
slave = Device("SLAVE_SERIAL")
master = Device("MASTER_SERIAL")

from uiautomator.

xiaocong avatar xiaocong commented on August 20, 2024

Later of this week. For a workaround, you can download the uiautomator.py in develop branch to your local disk, and then run your script.

from uiautomator.

satishsn1 avatar satishsn1 commented on August 20, 2024

I am using the device with android 4.1 API 16, some of the functionality is not working ui automator. can you please provide your input what is wrong in this.
Is this device issue or script issue

Python 2.7.3 (default, Apr 10 2012, 23:24:47) [MSC v.1500 64 bit (AMD64)] on win
32
Type "help", "copyright", "credits" or "license" for more information.

from uiautomator import Device
d=Device("5EA400060B00D00E")
d.info
{u'displayRotation': 0, u'displaySizeDpY': 0, u'displaySizeDpX': 0, u'currentPac
kageName': u'android', u'productName': None, u'displayWidth': 480, u'sdkInt': 16
, u'displayHeight': 800, u'naturalOrientation': False}
d.screen.off()
d.screen.on()
d(text="Clock").click()
Traceback (most recent call last):
File "", line 1, in
File "C:\Python27\lib\site-packages\uiautomator.py", line 50, in call
return self.func(_args, *_kwargs)
File "C:\Python27\lib\site-packages\uiautomator.py", line 658, in _click
return self.jsonrpc.click(self.selector)
File "C:\Python27\lib\site-packages\uiautomator.py", line 79, in call
(jsonresult["error"]["code"], jsonresult["error"]["message"]))
Exception: Error response. Error code: -32002, Error message: By[TEXT=Clock]
d(text="Clock").click()
Traceback (most recent call last):
File "", line 1, in
File "C:\Python27\lib\site-packages\uiautomator.py", line 50, in call
return self.func(_args, *_kwargs)
File "C:\Python27\lib\site-packages\uiautomator.py", line 658, in _click
return self.jsonrpc.click(self.selector)
File "C:\Python27\lib\site-packages\uiautomator.py", line 79, in call
(jsonresult["error"]["code"], jsonresult["error"]["message"]))
Exception: Error response. Error code: -32002, Error message: By[TEXT=Clock]
d(text="Settings").click()
Traceback (most recent call last):
File "", line 1, in
File "C:\Python27\lib\site-packages\uiautomator.py", line 50, in call
return self.func(_args, *_kwargs)
File "C:\Python27\lib\site-packages\uiautomator.py", line 658, in _click
return self.jsonrpc.click(self.selector)
File "C:\Python27\lib\site-packages\uiautomator.py", line 79, in call
(jsonresult["error"]["code"], jsonresult["error"]["message"]))
Exception: Error response. Error code: -32002, Error message: By[TEXT=Settings]
d(text="Settings").click()
Traceback (most recent call last):
File "", line 1, in
File "C:\Python27\lib\site-packages\uiautomator.py", line 50, in call
return self.func(_args, *_kwargs)
File "C:\Python27\lib\site-packages\uiautomator.py", line 658, in _click
return self.jsonrpc.click(self.selector)
File "C:\Python27\lib\site-packages\uiautomator.py", line 79, in call
(jsonresult["error"]["code"], jsonresult["error"]["message"]))
Exception: Error response. Error code: -32002, Error message: By[TEXT=Settings]

from uiautomator.

xiaocong avatar xiaocong commented on August 20, 2024

error code -32002 means the UiObjectNotFound. If the ui selector can not find the specified ui object, it will raise error.

d(text='Clock').click()  # means click the 'Clock' text in current screen. If it doesn't exist, an exception will be raised.

You can use d(text='Clock').exists to check if the ui object exists in current screen.

There are some differences between API level 16/17/18. If you meet error code -32003, it means the method is not supported in your device.

from uiautomator.

satishsn1 avatar satishsn1 commented on August 20, 2024

i had executed d(text='Clock').click() on the screen where i am seeing the Clock application
and i tired to execute the d(text='Clock').exists it is returning False.
As though the object present in the screen i am getting as false. Also the method is supported.

d(text="Clock").click()
Traceback (most recent call last):
File "", line 1, in
File "C:\Python27\lib\site-packages\uiautomator.py", line 50, in call
return self.func(_args, *_kwargs)
File "C:\Python27\lib\site-packages\uiautomator.py", line 658, in _click
return self.jsonrpc.click(self.selector)
File "C:\Python27\lib\site-packages\uiautomator.py", line 79, in call
(jsonresult["error"]["code"], jsonresult["error"]["message"]))
Exception: Error response. Error code: -32002, Error message: By[TEXT=Clock]
d(text="Clock").exists
False

from uiautomator.

xiaocong avatar xiaocong commented on August 20, 2024

Could you please use d.dump('screen.xml') and upload the xml here.

from uiautomator.

satishsn1 avatar satishsn1 commented on August 20, 2024

d.dump('screen.xml')
Traceback (most recent call last):
File "", line 1, in
File "C:\Python27\lib\site-packages\uiautomator.py", line 401, in dump
device_file = self.server.jsonrpc.dumpWindowHierarchy(True, "dump.xml")
File "C:\Python27\lib\site-packages\uiautomator.py", line 79, in call
(jsonresult["error"]["code"], jsonresult["error"]["message"]))
Exception: Error response. Error code: 0, Error message: UiAutomationService not
connected. Did you call #register()?

from uiautomator.

xiaocong avatar xiaocong commented on August 20, 2024

Likely UiAutomationService down. I am opening another issue #9 to track it. Thank @satishsn1

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.