用appium怎样测试imageview的切换

如题所述

第1个回答  2016-04-06
print driver.contexts
driver.switch_to.context('WEBVIEW')
els = self.driver.find_elements_by_xpath('//android.widget.TextView')
print len(els)
print els[0].text
appium 的log信息:
info: --> POST /wd/hub/session/ee2b3cf6-efa3-4bfe-93d9-05e61cf36001/elements {"u
sing":"xpath","sessionId":"ee2b3cf6-efa3-4bfe-93d9-05e61cf36001","value":"//andr
oid.widget.TextView"}
info: [debug] Proxying command to 127.0.0.1:9515
info: [debug] Making http request with opts: {"url":"http://127.0.0.1:9515/wd/hu
b/session/0c15293eb00d96ba09a36829af8334c4/elements","method":"POST","json":{"us
ing":"xpath","sessionId":"ee2b3cf6-efa3-4bfe-93d9-05e61cf36001","value":"//andro
id.widget.TextView"}}
info: [debug] Didn't get a new command in 60 secs, shutting down...
info: Shutting down appium session
info: [debug] Pressing the HOME button本回答被提问者采纳