# coding:utf-8

import os, time, unittest

from selenium import webdriver

desired_caps = {}

desired_caps['platformName'] = 'Android'

desired_caps['platformVersion'] = '4.4.2'

desired_caps['deviceName'] = '5205e06a'

desired_caps['appPackage'] = 'com.wxhkj.weixiuhui'

desired_caps['appActivity'] = 'com.wxhkj.weixiuhui.ui.main.MainWebActivity'

driver = webdriver.Remote("http://localhost:4723/wd/hub", desired_caps)

time.sleep(10)
try:
    els = driver.find_element_by_id('android:id/button2').text
    print (els)
    for el in els:
        if el.text == u'稍后更新':
            self.driver.find_element_by_id('android:id/button2').click()
            self.driver.find_element_by_id('com.wxhkj.weixiuhui:id/button').click()
        elif el.text == u'环境切换':
            self.driver.find_element_by_id('com.wxhkj.weixiuhui:id/button').click()
except:
    pass

问题描述:没走判断,是不能这样写吗


↙↙↙阅读原文可查看相关链接,并与作者交流