@panzhigang 那你是通过接口查看界面的元素吗?还是通过什么?
@panzhigang 转换以后 你是怎么处理 h5 中的数据呢? 比如是很多文字,你怎么取出来这些文字呢?
#1 楼 @lihuazhang 代码贴了哦,忘了点击回复您了。
代码如下:
class mytest(unittest.TestCase):
def setUp(self):
desired_caps = {}
desired_caps['platformName'] = 'Android'
desired_caps['platformVersion'] = '4.1'
desired_caps['deviceName'] = 'Android Emulator'
desired_caps['automationName'] = 'Selendroid'
desired_caps['app'] = PATH('D:/my.apk')
desired_caps['appPackage'] = 'com.cuc'
desired_caps['appActivity'] = '.cuc'
#desired_caps['aut'] = 'io.selendroid.testapp:0.10.0'
#desired_capabilities = {'aut': 'io.selendroid.testapp:0.10.0'}
self.driver = webdriver.Remote('http://localhost:4723/wd/hub', desired_caps)
time.sleep(5)
def tearDown(self):
self.driver.quit()
def testxiadan01(self):
driver = self.driver
driver.find_elements_by_class_name("android.widget.TextView")[11].click()
time.sleep(2)
driver.find_elements_by_class_name("android.widget.TextView")[5].click()
driver.find_element_by_name("下单").click()
if name == 'main':
suite = unittest.TestLoader().loadTestsFromTestCase(mytest)
unittest.TextTestRunner(verbosity=2).run(suite)