예제 #1
0
@author: diego
'''

import re
import sys
import os

try:
    sys.path.append(os.path.join(os.environ['ANDROID_VIEW_CLIENT_HOME'],
                                 'src'))
except:
    pass

from androidviewclient3.viewclient import ViewClient, TextView, EditText

device, serialno = ViewClient.connectToDeviceOrExit()
vc = ViewClient(device=device, serialno=serialno)
#send = vc.findViewWithTextOrRaise('Send')
send = vc.findViewByIdOrRaise('id/send')
#to = EditText(vc.findViewByIdOrRaise('id/to'))
to = vc.findViewByIdOrRaise('id/to')
subject = vc.findViewByIdOrRaise('id/subject')
subject.touch()
subject.type('AVCSample')
ViewClient.sleep(10)
to.touch()
#to.type('*****@*****.**')
device.type('*****@*****.**')
ViewClient.sleep(10)
send.touch()
#! /usr/bin/env python
'''
Copyright (C) 2012  Diego Torres Milano
Created on Oct 12, 2012
@author: diego
'''
import re
import sys
import os
try:
    sys.path.append(os.path.join(os.environ['ANDROID_VIEW_CLIENT_HOME'],
                                 'src'))
except:
    pass
from androidviewclient3.viewclient import ViewClient
VPS = "javascript:alert(document.getElementsByTagName('html')[0].innerHTML);"
USE_BROWSER = True
if USE_BROWSER:
    package = 'com.android.browser'
    activity = '.BrowserActivity'
    _id = 'id/no_id/12'
else:
    package = 'com.android.chrome'
    activity = 'com.google.android.apps.chrome.Main'
    _id = 'id/no_id/28'
component = package + "/" + activity
uri = 'http://dtmilano.blogspot.com'
device, serialno = ViewClient.connectToDeviceOrExit()
device.startActivity(component=component, uri=uri)
ViewClient.sleep(5)
예제 #3
0
#! /usr/bin/env python
'''
Copyright (C) 2012  Diego Torres Milano
Created on Feb 3, 2012
This example starts the TemperatureConverter activity then type '123' into the 'Celsius' field.
Then a ViewClient is created to obtain the view dump and the current values of the views with
id/celsius and id/fahrenheit are obtained and the conversion printed to stdout.
Finally, the fields are obtained by using their tags and again, conversion printed to stdout.
If --localViewServer is passed in the command line then LocalViewServer provided by
TemperatureConverter is used. This is very useful when the device is secure and ViewServer
cannot be started.
@author: diego
'''
import re
import sys
import os
import time
# PyDev sets PYTHONPATH, use it
try:
    for p in os.environ['PYTHONPATH'].split(':'):
        if not p in sys.path:
            sys.path.append(p)
except:
    pass
try:
    sys.path.append(os.path.join(os.environ['ANDROID_VIEW_CLIENT_HOME'],
                                 'src'))
except:
    pass
from androidviewclient3.viewclient import ViewClient
#! /usr/bin/env python
'''
Copyright (C) 2012  Diego Torres Milano
Created on Mar 13, 2012
@author: diego
'''
import re
import sys
import os
import string
try:
    sys.path.append(os.path.join(os.environ['ANDROID_VIEW_CLIENT_HOME'],
                                 'src'))
except:
    pass
from androidviewclient3.viewclient import ViewClient
USE_BROWSER = True
# Starting: Intent { act=android.intent.action.MAIN flg=0x10000000 cmp=com.android.browser/.BrowserActivity }
if USE_BROWSER:
    package = 'com.android.browser'
    activity = '.BrowserActivity'
else:
    package = 'com.android.chrome'
    activity = 'com.google.android.apps.chrome.Main'
component = package + "/" + activity
uri = 'http://dtmilano.blogspot.com'
device, serialno = ViewClient.connectToDeviceOrExit()
device.startActivity(component=component, uri=uri)
ViewClient.sleep(5)
vc = ViewClient(device, serialno)