Comments (10)
You raised an interesting point. At some point AVC is expecting emulator names starting with emulator
.
It seems a bug. I'm checking it.
Is screenshot.py
like the one in examples?
from androidviewclient.
@dtmilano it's pretty much like the one in the examples dir. It just has extra actions that are particular to my app (tapping on elements, etc).
It works fine on an actual device and on AVDs named "emulator-5554", but fails in this particular case.
from androidviewclient.
You may try specifying the serial number on the command line:
$ ./screenshot.py ~/tmp/sc7.png localhost:54266
__connect()
checkVersion(reconnect=True)
__send(host:version, checkok=True, reconnect=False)
checkConnected()
checkConnected: returning True
__checkOk()
checkConnected()
checkConnected: returning True
setAlarm(15)
__checkOk: recv= 'OKAY'
setAlarm(0)
__checkOk: returning True
__connect()
__setTransport()
checkConnected()
checkConnected: returning True
getDevices()
__send(host:devices-l, checkok=False, reconnect=False)
checkConnected()
checkConnected: returning True
__checkOk()
checkConnected()
checkConnected: returning True
setAlarm(15)
__checkOk: recv= 'OKAY'
setAlarm(0)
__checkOk: returning True
__receive()
checkConnected()
checkConnected: returning True
__receive: receiving 97 bytes
__receive: returning len= 97
Device.factory( localhost:54266 device product:sdk_x86 model:Android_SDK_built_for_x86 device:generic_x86 )
values= ['localhost:54266', 'device', 'product:sdk_x86 model:Android_SDK_built_for_x86 device:generic_x86']
__connect()
__setTransport: msg= host:transport:localhost:54266
__send(host:transport:localhost:54266, checkok=True, reconnect=False)
checkConnected()
checkConnected: returning True
__checkOk()
checkConnected()
checkConnected: returning True
setAlarm(15)
__checkOk: recv= 'OKAY'
setAlarm(0)
__checkOk: returning True
shell(cmd=getprop ro.secure)
__send(shell:getprop ro.secure, checkok=True, reconnect=False)
__checkOk()
checkConnected()
checkConnected: returning True
setAlarm(15)
__checkOk: recv= 'OKAY'
setAlarm(0)
__checkOk: returning True
Reconnecting...
Closing socket... <socket._socketobject object at 0x10052d9f0>
__connect()
__setTransport()
checkConnected()
checkConnected: returning True
getDevices()
__send(host:devices-l, checkok=False, reconnect=False)
checkConnected()
checkConnected: returning True
__checkOk()
checkConnected()
checkConnected: returning True
setAlarm(15)
__checkOk: recv= 'OKAY'
setAlarm(0)
__checkOk: returning True
__receive()
checkConnected()
checkConnected: returning True
__receive: receiving 97 bytes
__receive: returning len= 97
Device.factory( localhost:54266 device product:sdk_x86 model:Android_SDK_built_for_x86 device:generic_x86 )
values= ['localhost:54266', 'device', 'product:sdk_x86 model:Android_SDK_built_for_x86 device:generic_x86']
__connect()
__setTransport: msg= host:transport:localhost:54266
__send(host:transport:localhost:54266, checkok=True, reconnect=False)
checkConnected()
checkConnected: returning True
__checkOk()
checkConnected()
checkConnected: returning True
setAlarm(15)
__checkOk: recv= 'OKAY'
setAlarm(0)
__checkOk: returning True
shell(cmd=getprop ro.debuggable)
__send(shell:getprop ro.debuggable, checkok=True, reconnect=False)
__checkOk()
checkConnected()
checkConnected: returning True
setAlarm(15)
__checkOk: recv= 'OKAY'
setAlarm(0)
__checkOk: returning True
Reconnecting...
Closing socket... <socket._socketobject object at 0x10052d9f0>
__connect()
__setTransport()
checkConnected()
checkConnected: returning True
getDevices()
__send(host:devices-l, checkok=False, reconnect=False)
checkConnected()
checkConnected: returning True
__checkOk()
checkConnected()
checkConnected: returning True
setAlarm(15)
__checkOk: recv= 'OKAY'
setAlarm(0)
__checkOk: returning True
__receive()
checkConnected()
checkConnected: returning True
__receive: receiving 97 bytes
__receive: returning len= 97
Device.factory( localhost:54266 device product:sdk_x86 model:Android_SDK_built_for_x86 device:generic_x86 )
values= ['localhost:54266', 'device', 'product:sdk_x86 model:Android_SDK_built_for_x86 device:generic_x86']
__connect()
__setTransport: msg= host:transport:localhost:54266
__send(host:transport:localhost:54266, checkok=True, reconnect=False)
checkConnected()
checkConnected: returning True
__checkOk()
checkConnected()
checkConnected: returning True
setAlarm(15)
__checkOk: recv= 'OKAY'
setAlarm(0)
__checkOk: returning True
shell(cmd=getprop ro.build.version.sdk)
__send(shell:getprop ro.build.version.sdk, checkok=True, reconnect=False)
__checkOk()
checkConnected()
checkConnected: returning True
setAlarm(15)
__checkOk: recv= 'OKAY'
setAlarm(0)
__checkOk: returning True
Reconnecting...
Closing socket... <socket._socketobject object at 0x10052d9f0>
__connect()
__setTransport()
checkConnected()
checkConnected: returning True
getDevices()
__send(host:devices-l, checkok=False, reconnect=False)
checkConnected()
checkConnected: returning True
__checkOk()
checkConnected()
checkConnected: returning True
setAlarm(15)
__checkOk: recv= 'OKAY'
setAlarm(0)
__checkOk: returning True
__receive()
checkConnected()
checkConnected: returning True
__receive: receiving 97 bytes
__receive: returning len= 97
Device.factory( localhost:54266 device product:sdk_x86 model:Android_SDK_built_for_x86 device:generic_x86 )
values= ['localhost:54266', 'device', 'product:sdk_x86 model:Android_SDK_built_for_x86 device:generic_x86']
__connect()
__setTransport: msg= host:transport:localhost:54266
__send(host:transport:localhost:54266, checkok=True, reconnect=False)
checkConnected()
checkConnected: returning True
__checkOk()
checkConnected()
checkConnected: returning True
setAlarm(15)
__checkOk: recv= 'OKAY'
setAlarm(0)
__checkOk: returning True
__send(framebuffer:, checkok=True, reconnect=False)
__checkOk()
checkConnected()
checkConnected: returning True
setAlarm(15)
__checkOk: recv= 'OKAY'
setAlarm(0)
__checkOk: returning True
__receive()
checkConnected()
checkConnected: returning True
__receive: receiving 52 bytes
__receive: returning len= 52
takeSnapshot: (1, 16, 2048000, 1280, 800, 11, 5, 0, 5, 5, 6, 0, 0)
takeSnapshot: (1, 16, 2048000, 1280, 800, 11, 5, 0, 5, 5, 5, 0, 0, 'BGR')
__send(, checkok=False, reconnect=False)
takeSnapshot: reading 2048000 bytes
__receive()
checkConnected()
checkConnected: returning True
__receive: receiving 2048000 bytes
__receive: returning len= 2048000
takeSnapshot: Image.frombuffer(RGB, (1280, 800), data, raw, BGR;16, 0, 1)
Closing socket... <socket._socketobject object at 0x10052d9f0>
from androidviewclient.
@dtmilano I tried using your example script and it didn't work either.
After some more attempts I'm now getting a connection refused message which seems to be caused by the hardcoded 5037 port:
+ python screenshots-debug.py /Users/knorrium/test.png localhost:57276
__connect()
Traceback (most recent call last):
File "screenshots-debug.py", line 35, in <module>
device, serialno = ViewClient.connectToDeviceOrExit(verbose=False)
File "/Users/knorrium/dev/AndroidViewClient/AndroidViewClient/src/com/dtmilano/android/viewclient.py", line 1383, in connectToDeviceOrExit
device = adbclient.AdbClient(serialno)
File "/Users/knorrium/dev/AndroidViewClient/AndroidViewClient/src/com/dtmilano/android/adb/adbclient.py", line 82, in __init__
self.__connect()
File "/Users/knorrium/dev/AndroidViewClient/AndroidViewClient/src/com/dtmilano/android/adb/adbclient.py", line 109, in __connect
raise RuntimeError("ERROR: Connecting to %s:%d: %s" % (self.socket, self.port, ex))
RuntimeError: ERROR: Connecting to <socket._socketobject object at 0x1024fcd70>:5037: [Errno 61] Connection refused
Closing socket... <socket._socketobject object at 0x1024fcd70>
Build step 'Execute shell' marked build as failure
$ /Applications/adt-bundle-mac-x86_64/sdk/platform-tools/adb disconnect localhost:57276
[android] Stopping Android emulator
The Android emulator plugin assigns random ports every time it's called:
/Applications/adt-bundle-mac-x86_64/sdk/tools/emulator -no-boot-anim -ports 57754,57755 -prop persist.sys.language=en -prop persist.sys.country=US -avd hudson_en-US_240_QVGA_Google_Inc._Google_APIs_10 -no-snapshot-load -no-snapshot-save -wipe-data -partition-size 300
Is there any way I can override that port?
from androidviewclient.
What's the output of
$ ps -aef | grep adb
(perhaps taken while the job is running)
On Tue, Oct 1, 2013 at 5:44 PM, Felipe Knorr Kuhn
[email protected]:
@dtmilano https://github.com/dtmilano I tried using your example script
and it didn't work either.After some more attempts I'm now getting a connection refused message
which seems to be caused by the hardcoded 5037 port:
- python screenshots-debug.py /Users/knorrium/test.png localhost:57276
connect()
Traceback (most recent call last):
File "screenshots-debug.py", line 35, in
device, serialno = ViewClient.connectToDeviceOrExit(verbose=False)
File "/Users/knorrium/dev/AndroidViewClient/AndroidViewClient/src/com/dtmilano/android/viewclient.py", line 1383, in connectToDeviceOrExit
device = adbclient.AdbClient(serialno)
File "/Users/knorrium/dev/AndroidViewClient/AndroidViewClient/src/com/dtmilano/android/adb/adbclient.py", line 82, in __init
self.__connect()
File "/Users/knorrium/dev/AndroidViewClient/AndroidViewClient/src/com/dtmilano/android/adb/adbclient.py", line 109, in __connect
raise RuntimeError("ERROR: Connecting to %s:%d: %s" % (self.socket, self.port, ex))
RuntimeError: ERROR: Connecting to <socket._socketobject object at 0x1024fcd70>:5037: [Errno 61] Connection refused
Closing socket... <socket._socketobject object at 0x1024fcd70>
Build step 'Execute shell' marked build as failure
$ /Applications/adt-bundle-mac-x86_64/sdk/platform-tools/adb disconnect localhost:57276
[android] Stopping Android emulatorThe Android emulator plugin assigns random ports every time it's called:
/Applications/adt-bundle-mac-x86_64/sdk/tools/emulator -no-boot-anim
-ports 57754,57755 -prop persist.sys.language=en -prop
persist.sys.country=US -avd
hudson_en-US_240_QVGA_Google_Inc._Google_APIs_10 -no-snapshot-load
-no-snapshot-save -wipe-data -partition-size 300Is there any way I can override that port?
—
Reply to this email directly or view it on GitHubhttps://github.com//issues/54#issuecomment-25494182
.
Have you read my blog ?
http://dtmilano.blogspot.com
android junit tests ui linux cult thin clients
from androidviewclient.
@dtmilano the adb server is running
501 59577 1 0 2:14PM ttys000 0:00.11 adb fork-server server 501 69312 1 0 3:12PM ttys000 0:00.33 adb fork-server server 501 69458 97688 0 3:13PM ttys000 0:00.02 /Applications/adt-bundle-mac-x86_64/sdk/platform-tools/adb -s localhost:59717 logcat -v time
I was able to get AVC to connect to the emulator by changing PORT = 5037
to PORT = int(os.environ['ANDROID_ADB_SERVER_PORT'])
This ANDROID_ADB_SERVER_PORT variable is exposed by the Jenkins Android Emulator plugin.
I'm thinking about the best way to handle this case, maybe connectToDeviceOrExit()
could accept a new ADB port parameter?
from androidviewclient.
Should be fixed by db9a1ca.
from androidviewclient.
@dtmilano I'll test it out tomorrow and will close the issue, thanks again! :)
from androidviewclient.
Thanks for reporting!
On Wed, Oct 2, 2013 at 12:19 AM, Felipe Knorr Kuhn <[email protected]
wrote:
@dtmilano https://github.com/dtmilano I'll test it out tomorrow and
will close the issue, thanks again! :)—
Reply to this email directly or view it on GitHubhttps://github.com//issues/54#issuecomment-25512458
.
Have you read my blog ?
http://dtmilano.blogspot.com
android junit tests ui linux cult thin clients
from androidviewclient.
It's working, closing the issue.
from androidviewclient.
Related Issues (20)
- Find Password flag state in vc.dump() data HOT 1
- [Errno 8] nodename nor servname provided, or not known. HOT 4
- Multi-swipe HOT 2
- startActivity() doesn't work HOT 3
- How to deal with file dialog HOT 1
- Help me with incomplete escape \U at position 2 HOT 14
- please Help me with touch not response HOT 3
- How to get pop-up messages in app HOT 4
- can not use the examples browser-open-url.py HOT 2
- takeSnapshot fails after first time HOT 4
- Can't find or read elements with Unity game HOT 7
- Exception: adb="adb.exe" is not executable. HOT 1
- ValueError: received does not contain valid XML: Killed HOT 7
- Take SnapShot with TimeOutException HOT 15
- 22.3.0 does not support Python 3.7.7 HOT 2
- error using helper HOT 1
- CulebraTester2 backend: error when using findViewWithAttributeThatMatches HOT 4
- ViewClient crash due to __parseTreeFromUiAutomatorDump ? HOT 4
- Example of using Pinch HOT 3
- [Bug] `dump -a` throws error HOT 5
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 androidviewclient.