appium 小白,看例子自己写了一个很简单的登录脚本,可是一直报错不能执行,求原因,谢谢!
代码:
#! /usr/bin/env python
#coding=utf-8
#coding=utf-8
import os
import time
import unittest
from appium import webdriver
import sys
reload(sys)
sys.setdefaultencoding('utf-8')
class ContactsAndroidTests(unittest.TestCase):
def setUp(self):
desired_caps = {}
desired_caps['platformName'] = 'Android'
desired_caps['platformVersion'] = '4.4.3'
desired_caps['deviceName'] = 'Android Emulator'
desired_caps['appPackage'] = 'com.lianlian.app'
desired_caps['appActivity'] = 'com.lianlian.app.ui.activity.WelcomeActivity'
self.driver = webdriver.Remote('http://127.0.0.1:4723/wd/hub', desired_caps)
def tearDown(self):
self.drive.quit()
def test_login(self):
e1=self.driver.find_element_by_name("我的").click()
time.sleep(10)
e2=self.driver.find_element_by_id("com.lianlian.app:id/mine_phone_no").click()
time.sleep(10)
e3=self.driver.find_element_by_id("com.lianlian.app:id/mobile_no").send_keys('12345678901')
time.sleep(10)
e4=self.driver.find_element_by_id("com.lianlian.app:id/password").send_keys('123456')
time.sleep(10)
e5=self.driver.find_element_by_id("com.lianlian.app:id/login").click()
self.assertEqual(self.driver.find_element_by_id('com.lianlian.app:id/my_score_count_tv').text,u'40519','登录失败')
if __name__ == '__main__':
suite = unittest.TestLoader().loadTestsFromTestCase(ContactsAndroidTests)
unittest.TextTestRunner(verbosity=2).run(suite)
哪里有错吗,小白,求指教