Comments (9)
There are several ways:
-
Use
adb -s SLAVE_SERIAL shell am start
withIntent.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.
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.
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.
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.
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.
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.
Could you please use d.dump('screen.xml')
and upload the xml here.
from uiautomator.
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.
Likely UiAutomationService down. I am opening another issue #9 to track it. Thank @satishsn1
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.