我正在嘗試使用Culbera測試下拉列表。我的菜單結構如下Culbera:從Android應用中的下拉列表中選擇東西
Main Page
-- Program - Setup - Arm
- Torque
-- Test
現在Arm
顯示(使可見)一個下拉列表,顯示ARM類型的列表。
我想從下拉列表中選擇一個,然後按Program Arm Type
。出於某種原因,這不能按預期工作。
當我用
python culebra -Gu -o command_trace.txt --scale=01.0
我得到的痕跡
vc.findViewWithTextOrRaise(u'Arm').touch()
vc.sleep(_s)
vc.dump(window=-1)
vc.findViewByIdOrRaise("id/no_id/21").setText(u"xxx")
vc.sleep(_s)
vc.dump(window=-1)
vc.findViewWithTextOrRaise(u'OK').touch()
vc.sleep(_s)
vc.dump(window=-1)
vc.findViewWithTextOrRaise(u'Program ArmType').touch()
vc.sleep(_s)
vc.dump(window=-1)
它彈出的文本框中。 (我不知道它來自哪裏)?有人能解釋如何在Culbera
import re
import sys
import os
import time
from com.dtmilano.android.viewclient import ViewClient
from com.dtmilano.android.adb.adbclient import DOWN_AND_UP
kwargs1 = {'ignoreversioncheck': False, 'verbose': False, 'ignoresecuredevice': False}
device, serialno = ViewClient.connectToDeviceOrExit(**kwargs1)
kwargs2 = {'forceviewserveruse': False, 'useuiautomatorhelper': False, 'ignoreuiautomatorkilled': True, 'autodump': False, 'startviewserver': True, 'compresseddump': True}
_s = 3
_v = '--verbose' in sys.argv
vc = ViewClient(device, serialno, **kwargs2)
# Installs the Android package. Notice that this method returns a boolean, so you can test
# to see if the installation worked.
#vc.installPackage('AbcApp.Android.AbcApp.Android-Signed.apk')
# sets a variable with the package's internal name
package = 'AbcApp.Android.AbcApp.Android'
# sets a variable with the name of an Activity in the packag
activity = 'md591ecfcc0189ae8714.MainActivity'
# sets the name of the component to start
runComponent = package + '/' + activity
# Runs the component
device.startActivity(component=runComponent)
vc.sleep(5)
def GoToView(s):
vc.findViewWithTextOrRaise(unicode(s)).touch()
vc.sleep(_s)
vc.dump(window=-1)
vc.dump(window=-1)
GoToView('Program')
GoToView('Setup')
vc.findViewWithTextOrRaise(u'Arm').touch()
vc.sleep(_s)
vc.dump(window=-1)
vc.findViewWithTextOrRaise(u'OK').touch()
vc.sleep(_s)
vc.dump(window=-1)
vc.findViewWithTextOrRaise(u'Program ArmType').touch()
vc.sleep(_s)
vc.dump(window=-1)
GoToView('Main')
@DiegoTorresMilano - 你可以看看這個嗎?謝謝 – liv2hak
我不明白你的意思,「它彈出一個文本框(我不知道它來自哪裏)?」 –
你可以添加截圖嗎? –