Skip to content

Commit 6156770

Browse files
committed
Added write-image-to-file.py example
1 parent 98f3443 commit 6156770

1 file changed

Lines changed: 36 additions & 0 deletions

File tree

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
#! /usr/bin/env python
2+
# -*- coding: utf-8 -*-
3+
'''
4+
Copyright (C) 2013 Diego Torres Milano
5+
Created on 2014-03-10 by Culebra v4.10.1
6+
7+
__ __ __ __
8+
/ \ / \ / \ / \
9+
____________________/ __\/ __\/ __\/ __\_____________________________
10+
___________________/ /__/ /__/ /__/ /________________________________
11+
| / \ / \ / \ / \ \___
12+
|/ \_/ \_/ \_/ \ o \
13+
\_____/--<
14+
@author: Diego Torres Milano
15+
@author: Jennifer E. Swofford (ascii art snake)
16+
'''
17+
18+
19+
import re
20+
import sys
21+
import os
22+
23+
24+
from com.dtmilano.android.viewclient import ViewClient
25+
26+
if len(sys.argv) < 2:
27+
sys.exit("usage: %s /path/to/filename.png [serialno]" % sys.argv[0])
28+
29+
filename = sys.argv.pop(1)
30+
kwargs1 = {'verbose': False, 'ignoresecuredevice': False}
31+
device, serialno = ViewClient.connectToDeviceOrExit(**kwargs1)
32+
kwargs2 = {'startviewserver': True, 'forceviewserveruse': False, 'autodump': False, 'ignoreuiautomatorkilled': True}
33+
vc = ViewClient(device, serialno, **kwargs2)
34+
vc.dump(window='-1')
35+
36+
vc.findViewWithContentDescriptionOrRaise('''Home screen 3''').writeImageToFile(filename, 'PNG')

0 commit comments

Comments
 (0)