获取当前 activity 名称和包?
Get current activity name and package?
我有一个启动新 Activity 的按钮。 AndroidViewClient中有没有API获取当前activity的包和名称?类似于:
view.click() # starts a new activity
ViewClient.sleep(5) # wait for it to start
activityName = magic.getActivityName()
activityPackage = magic.getActivityPackage()
谢谢
这会打印顶部 Activity 和包
#! /usr/bin/env python
# -*- coding: utf-8 -*-
'''
Copyright (C) 2013-2017 Diego Torres Milano
Created on 2017-07-18 by Culebra v13.4.0
__ __ __ __
/ \ / \ / \ / \
____________________/ __\/ __\/ __\/ __\_____________________________
___________________/ /__/ /__/ /__/ /________________________________
| / \ / \ / \ / \ \___
|/ \_/ \_/ \_/ \ o \
\_____/--<
@author: Diego Torres Milano
@author: Jennifer E. Swofford (ascii art snake)
'''
import re
import sys
import os
from com.dtmilano.android.viewclient import ViewClient
TAG = 'CULEBRA'
_s = 5
_v = '--verbose' in sys.argv
kwargs1 = {'ignoreversioncheck': False, 'verbose': False, 'ignoresecuredevice': False}
device, serialno = ViewClient.connectToDeviceOrExit(**kwargs1)
print device.getTopActivityName()
例如
com.android.calculator2/.Calculator
我有一个启动新 Activity 的按钮。 AndroidViewClient中有没有API获取当前activity的包和名称?类似于:
view.click() # starts a new activity
ViewClient.sleep(5) # wait for it to start
activityName = magic.getActivityName()
activityPackage = magic.getActivityPackage()
谢谢
这会打印顶部 Activity 和包
#! /usr/bin/env python
# -*- coding: utf-8 -*-
'''
Copyright (C) 2013-2017 Diego Torres Milano
Created on 2017-07-18 by Culebra v13.4.0
__ __ __ __
/ \ / \ / \ / \
____________________/ __\/ __\/ __\/ __\_____________________________
___________________/ /__/ /__/ /__/ /________________________________
| / \ / \ / \ / \ \___
|/ \_/ \_/ \_/ \ o \
\_____/--<
@author: Diego Torres Milano
@author: Jennifer E. Swofford (ascii art snake)
'''
import re
import sys
import os
from com.dtmilano.android.viewclient import ViewClient
TAG = 'CULEBRA'
_s = 5
_v = '--verbose' in sys.argv
kwargs1 = {'ignoreversioncheck': False, 'verbose': False, 'ignoresecuredevice': False}
device, serialno = ViewClient.connectToDeviceOrExit(**kwargs1)
print device.getTopActivityName()
例如
com.android.calculator2/.Calculator