def test_login(self): #登录界面 for i in range(1,nrows): common.findID(self, self.driver, "com.jrdcom.wearable.smartband2:id/main_menu_list") common.findID(self, self.driver, "com.jrdcom.wearable.smartband2:id/user_nickname_text") ema = common.get_login_email(i) pas = common.get_login_password(i) mes = common.get_login_message(i) #将浮点数转为整型数 self.email = str(common.isnumber(ema)) self.password = str(common.isnumber(pas)) self.message = str(mes) loginEmail = self.driver.find_element_by_id("com.jrdcom.wearable.smartband2:id/email_ed") loginEmail.click() context = loginEmail.get_attribute("text") common.text_clear(self.driver, context) loginEmail.send_keys(self.email) loginPassword = self.driver.find_element_by_id("com.jrdcom.wearable.smartband2:id/password_ed") loginPassword.send_keys(self.password) #登录 print self.email,self.password,self.message self.driver.keyevent(4)
def test_login(self): #登录界面 for i in range(1, nrows): common.findID(self, self.driver, "com.jrdcom.wearable.smartband2:id/main_menu_list") common.findID( self, self.driver, "com.jrdcom.wearable.smartband2:id/user_nickname_text") ema = common.get_login_email(i) pas = common.get_login_password(i) mes = common.get_login_message(i) #将浮点数转为整型数 self.email = str(common.isnumber(ema)) self.password = str(common.isnumber(pas)) self.message = str(mes) loginEmail = self.driver.find_element_by_id( "com.jrdcom.wearable.smartband2:id/email_ed") loginEmail.click() context = loginEmail.get_attribute("text") common.text_clear(self.driver, context) loginEmail.send_keys(self.email) loginPassword = self.driver.find_element_by_id( "com.jrdcom.wearable.smartband2:id/password_ed") loginPassword.send_keys(self.password) #登录 print self.email, self.password, self.message self.driver.keyevent(4)
def test_login_code(self): # 登录界面 common.findID(self, self.driver, "com.jrdcom.wearable.smartband2:id/main_menu_list") common.findID(self, self.driver, "com.jrdcom.wearable.smartband2:id/user_nickname_text") common.findID(self, self.driver, "com.jrdcom.wearable.smartband2:id/login_login") common.findID(self, self.driver, "com.jrdcom.wearable.smartband2:id/login_forgot_password") EmailAdress = self.driver.find_element_by_id("com.jrdcom.wearable.smartband2:id/email_ed") EmailAdress.send_keys("*****@*****.**") common.findID(self, self.driver, "com.jrdcom.wearable.smartband2:id/bt_refer") time.sleep(8) common.identifyingCode(self.driver, "com.jrdcom.wearable.smartband2:id/captcha_image_view")
def test_login_code(self): # 登录界面 common.findID(self, self.driver, "com.jrdcom.wearable.smartband2:id/main_menu_list") common.findID(self, self.driver, "com.jrdcom.wearable.smartband2:id/user_nickname_text") common.findID(self, self.driver, "com.jrdcom.wearable.smartband2:id/login_login") common.findID( self, self.driver, "com.jrdcom.wearable.smartband2:id/login_forgot_password") EmailAdress = self.driver.find_element_by_id( "com.jrdcom.wearable.smartband2:id/email_ed") EmailAdress.send_keys("*****@*****.**") common.findID(self, self.driver, "com.jrdcom.wearable.smartband2:id/bt_refer") time.sleep(8) common.identifyingCode( self.driver, "com.jrdcom.wearable.smartband2:id/captcha_image_view")
def test_watch_face(self): try: common.findID(self, self.driver, "com.jrdcom.wearable.smartband2:id/connect_status_icon") common.findID(self, self.driver, "com.jrdcom.wearable.smartband2:id/watch_face_layout") common.findXpath(self, self.driver, "//android.widget.LinearLayout[1]/android.widget.FrameLayout[1]/android.widget.RelativeLayout[1]/android.widget.RelativeLayout[2]/android.widget.GridView[1]/android.widget.FrameLayout[1]/android.widget.ImageView[1]").click() common.findID(self, self.driver, "com.jrdcom.wearable.smartband2:id/apply_button") WebDriverWait(self.driver, 100).until( lambda x: x.find_element_by_id("com.jrdcom.wearable.smartband2:id/watch_style")) c = 1 print c print(""" "Mood" """ "Watch face check ok.") # Classic b = 1 for a in range(4): common.clickAgain(self, self.driver, "//android.widget.LinearLayout[1]/android.widget.FrameLayout[1]/android.widget.RelativeLayout[1]/android.widget.RelativeLayout[2]/android.widget.GridView[1]/android.widget.FrameLayout[2]/android.widget.ImageView[1]", "//android.widget.LinearLayout[1]/android.widget.FrameLayout[1]/android.widget.LinearLayout[1]/android.widget.LinearLayout[1]/android.widget.ScrollView[1]/android.widget.LinearLayout[1]/android.widget.LinearLayout[2]/android.widget.HorizontalScrollView[1]/android.widget.LinearLayout[1]/android.widget.FrameLayout[%s]/android.widget.ImageView[1]" % b) common.swipeToRight(self.driver, "com.jrdcom.wearable.smartband2:id/scrollViewWatchWallpaper") time.sleep(1) common.swipeToRight(self.driver, "com.jrdcom.wearable.smartband2:id/scrollViewWatchWallpaper") time.sleep(1) common.findXpath(self, self.driver, "//android.widget.LinearLayout[1]/android.widget.FrameLayout[1]/android.widget.LinearLayout[1]/android.widget.LinearLayout[1]/android.widget.ScrollView[1]/android.widget.LinearLayout[1]/android.widget.LinearLayout[2]/android.widget.HorizontalScrollView[2]/android.widget.LinearLayout[1]/android.widget.FrameLayout[1]/android.widget.ImageView[1]").click() common.findID(self, self.driver, "com.jrdcom.wearable.smartband2:id/apply_button") WebDriverWait(self.driver, 100).until( lambda x: x.find_element_by_id("com.jrdcom.wearable.smartband2:id/watch_style")) c = c + 1 print c common.clickAgain(self, self.driver, "//android.widget.LinearLayout[1]/android.widget.FrameLayout[1]/android.widget.RelativeLayout[1]/android.widget.RelativeLayout[2]/android.widget.GridView[1]/android.widget.FrameLayout[2]/android.widget.ImageView[1]", "//android.widget.LinearLayout[1]/android.widget.FrameLayout[1]/android.widget.LinearLayout[1]/android.widget.LinearLayout[1]/android.widget.ScrollView[1]/android.widget.LinearLayout[1]/android.widget.LinearLayout[2]/android.widget.HorizontalScrollView[1]/android.widget.LinearLayout[1]/android.widget.FrameLayout[%s]/android.widget.ImageView[1]" % b) common.findXpath(self, self.driver, "//android.widget.LinearLayout[1]/android.widget.FrameLayout[1]/android.widget.LinearLayout[1]/android.widget.LinearLayout[1]/android.widget.ScrollView[1]/android.widget.LinearLayout[1]/android.widget.LinearLayout[2]/android.widget.HorizontalScrollView[2]/android.widget.LinearLayout[1]/android.widget.FrameLayout[2]/android.widget.ImageView[1]").click() common.findID(self, self.driver, "com.jrdcom.wearable.smartband2:id/apply_button") WebDriverWait(self.driver, 100).until( lambda x: x.find_element_by_id("com.jrdcom.wearable.smartband2:id/watch_style")) c = c + 1 print c for i in range(14): try: common.clickAgain(self, self.driver, "//android.widget.LinearLayout[1]/android.widget.FrameLayout[1]/android.widget.RelativeLayout[1]/android.widget.RelativeLayout[2]/android.widget.GridView[1]/android.widget.FrameLayout[2]/android.widget.ImageView[1]", "//android.widget.LinearLayout[1]/android.widget.FrameLayout[1]/android.widget.LinearLayout[1]/android.widget.LinearLayout[1]/android.widget.ScrollView[1]/android.widget.LinearLayout[1]/android.widget.LinearLayout[2]/android.widget.HorizontalScrollView[1]/android.widget.LinearLayout[1]/android.widget.FrameLayout[%s]/android.widget.ImageView[1]" % b) common.findXpath(self, self.driver, "//android.widget.LinearLayout[1]/android.widget.FrameLayout[1]/android.widget.LinearLayout[1]/android.widget.LinearLayout[1]/android.widget.ScrollView[1]/android.widget.LinearLayout[1]/android.widget.LinearLayout[2]/android.widget.HorizontalScrollView[2]/android.widget.LinearLayout[1]/android.widget.FrameLayout[3]/android.widget.ImageView[1]").click() common.findID(self, self.driver, "com.jrdcom.wearable.smartband2:id/apply_button") except: common.clickAgain(self, self.driver, "//android.widget.LinearLayout[1]/android.widget.FrameLayout[1]/android.widget.RelativeLayout[1]/android.widget.RelativeLayout[2]/android.widget.GridView[1]/android.widget.FrameLayout[2]/android.widget.ImageView[1]", "//android.widget.LinearLayout[1]/android.widget.FrameLayout[1]/android.widget.LinearLayout[1]/android.widget.LinearLayout[1]/android.widget.ScrollView[1]/android.widget.LinearLayout[1]/android.widget.LinearLayout[2]/android.widget.HorizontalScrollView[1]/android.widget.LinearLayout[1]/android.widget.FrameLayout[%s]/android.widget.ImageView[1]" % b) common.findXpath(self, self.driver, "//android.widget.LinearLayout[1]/android.widget.FrameLayout[1]/android.widget.LinearLayout[1]/android.widget.LinearLayout[1]/android.widget.ScrollView[1]/android.widget.LinearLayout[1]/android.widget.LinearLayout[2]/android.widget.HorizontalScrollView[2]/android.widget.LinearLayout[1]/android.widget.FrameLayout[4]/android.widget.ImageView[1]").click() common.findID(self, self.driver, "com.jrdcom.wearable.smartband2:id/apply_button") c = c + 1 print c if c in [39, 40, 41]: try: queen = self.driver.find_element_by_id("com.jrdcom.wearable.smartband2:id/medal_name") Achievements = queen.get_attribute("name") print (Achievements) queen.click() except: print ("Get Queen Fail") continue else: continue WebDriverWait(self.driver, 100).until( lambda x: x.find_element_by_id("com.jrdcom.wearable.smartband2:id/watch_style")) time.sleep(2) common.clickAgain(self, self.driver, "//android.widget.LinearLayout[1]/android.widget.FrameLayout[1]/android.widget.RelativeLayout[1]/android.widget.RelativeLayout[2]/android.widget.GridView[1]/android.widget.FrameLayout[2]/android.widget.ImageView[1]", "//android.widget.LinearLayout[1]/android.widget.FrameLayout[1]/android.widget.LinearLayout[1]/android.widget.LinearLayout[1]/android.widget.ScrollView[1]/android.widget.LinearLayout[1]/android.widget.LinearLayout[2]/android.widget.HorizontalScrollView[1]/android.widget.LinearLayout[1]/android.widget.FrameLayout[%s]/android.widget.ImageView[1]" % b) common.findXpath(self, self.driver, "//android.widget.LinearLayout[1]/android.widget.FrameLayout[1]/android.widget.LinearLayout[1]/android.widget.LinearLayout[1]/android.widget.ScrollView[1]/android.widget.LinearLayout[1]/android.widget.LinearLayout[2]/android.widget.HorizontalScrollView[2]/android.widget.LinearLayout[1]/android.widget.FrameLayout[4]/android.widget.ImageView[1]").click() common.findID(self, self.driver, "com.jrdcom.wearable.smartband2:id/apply_button") WebDriverWait(self.driver, 100).until( lambda x: x.find_element_by_id("com.jrdcom.wearable.smartband2:id/watch_style")) c = c + 1 print c b = b + 1 time.sleep(1) print(""" "Classic" """ "Watch face check ok.") # Modern b = 1 for a in range(4): ele1 = "//android.widget.LinearLayout[1]/android.widget.FrameLayout[1]/android.widget.RelativeLayout[1]/android.widget.RelativeLayout[2]/android.widget.GridView[1]/android.widget.FrameLayout[3]/android.widget.ImageView[1]" ele2 = "//android.widget.LinearLayout[1]/android.widget.FrameLayout[1]/android.widget.LinearLayout[1]/android.widget.LinearLayout[1]/android.widget.ScrollView[1]/android.widget.LinearLayout[1]/android.widget.LinearLayout[2]/android.widget.HorizontalScrollView[1]/android.widget.LinearLayout[1]/android.widget.FrameLayout[%s]/android.widget.ImageView[1]" % b # Wallpaper common.clickAgain(self, self.driver, ele1, ele2) common.swipeToRight(self.driver, "com.jrdcom.wearable.smartband2:id/scrollViewWatchWallpaper") time.sleep(1) common.swipeToRight(self.driver, "com.jrdcom.wearable.smartband2:id/scrollViewWatchWallpaper") time.sleep(1) common.findXpath(self, self.driver, "//android.widget.LinearLayout[1]/android.widget.FrameLayout[1]/android.widget.LinearLayout[1]/android.widget.LinearLayout[1]/android.widget.ScrollView[1]/android.widget.LinearLayout[1]/android.widget.LinearLayout[2]/android.widget.HorizontalScrollView[2]/android.widget.LinearLayout[1]/android.widget.FrameLayout[1]/android.widget.ImageView[1]").click() common.findID(self, self.driver, "com.jrdcom.wearable.smartband2:id/apply_button") WebDriverWait(self.driver, 100).until( lambda x: x.find_element_by_id("com.jrdcom.wearable.smartband2:id/watch_style")) common.clickAgain(self, self.driver, ele1, ele2) common.findXpath(self, self.driver, "//android.widget.LinearLayout[1]/android.widget.FrameLayout[1]/android.widget.LinearLayout[1]/android.widget.LinearLayout[1]/android.widget.ScrollView[1]/android.widget.LinearLayout[1]/android.widget.LinearLayout[2]/android.widget.HorizontalScrollView[2]/android.widget.LinearLayout[1]/android.widget.FrameLayout[2]/android.widget.ImageView[1]").click() common.findID(self, self.driver, "com.jrdcom.wearable.smartband2:id/apply_button") WebDriverWait(self.driver, 100).until( lambda x: x.find_element_by_id("com.jrdcom.wearable.smartband2:id/watch_style")) for i in range(12): try: common.clickAgain(self, self.driver, ele1, ele2) common.findXpath(self, self.driver, "//android.widget.LinearLayout[1]/android.widget.FrameLayout[1]/android.widget.LinearLayout[1]/android.widget.LinearLayout[1]/android.widget.ScrollView[1]/android.widget.LinearLayout[1]/android.widget.LinearLayout[2]/android.widget.HorizontalScrollView[2]/android.widget.LinearLayout[1]/android.widget.FrameLayout[3]/android.widget.ImageView[1]").click() common.findID(self, self.driver, "com.jrdcom.wearable.smartband2:id/apply_button") WebDriverWait(self.driver, 100).until( lambda x: x.find_element_by_id("com.jrdcom.wearable.smartband2:id/watch_style")) except: common.clickAgain(self, self.driver, ele1, ele2) common.findXpath(self, self.driver, "//android.widget.LinearLayout[1]/android.widget.FrameLayout[1]/android.widget.LinearLayout[1]/android.widget.LinearLayout[1]/android.widget.ScrollView[1]/android.widget.LinearLayout[1]/android.widget.LinearLayout[2]/android.widget.HorizontalScrollView[2]/android.widget.LinearLayout[1]/android.widget.FrameLayout[4]/android.widget.ImageView[1]").click() common.findID(self, self.driver, "com.jrdcom.wearable.smartband2:id/apply_button") WebDriverWait(self.driver, 100).until( lambda x: x.find_element_by_id("com.jrdcom.wearable.smartband2:id/watch_style")) common.clickAgain(self, self.driver, ele1, ele2) common.findXpath(self, self.driver, "//android.widget.LinearLayout[1]/android.widget.FrameLayout[1]/android.widget.LinearLayout[1]/android.widget.LinearLayout[1]/android.widget.ScrollView[1]/android.widget.LinearLayout[1]/android.widget.LinearLayout[2]/android.widget.HorizontalScrollView[2]/android.widget.LinearLayout[1]/android.widget.FrameLayout[4]/android.widget.ImageView[1]").click() common.findID(self, self.driver, "com.jrdcom.wearable.smartband2:id/apply_button") WebDriverWait(self.driver, 100).until( lambda x: x.find_element_by_id("com.jrdcom.wearable.smartband2:id/watch_style")) # Color common.clickAgain(self, self.driver, ele1, ele2) common.swipeToRight(self.driver, "com.jrdcom.wearable.smartband2:id/scrollViewWatchColor") time.sleep(1) common.findXpath(self, self.driver, "//android.widget.LinearLayout[1]/android.widget.FrameLayout[1]/android.widget.LinearLayout[1]/android.widget.LinearLayout[1]/android.widget.ScrollView[1]/android.widget.LinearLayout[1]/android.widget.LinearLayout[2]/android.widget.HorizontalScrollView[3]/android.widget.LinearLayout[1]/android.widget.FrameLayout[1]/android.widget.ImageView[1]").click() common.findID(self, self.driver, "com.jrdcom.wearable.smartband2:id/apply_button") WebDriverWait(self.driver, 100).until( lambda x: x.find_element_by_id("com.jrdcom.wearable.smartband2:id/watch_style")) common.clickAgain(self, self.driver, ele1, ele2) common.findXpath(self, self.driver, "//android.widget.LinearLayout[1]/android.widget.FrameLayout[1]/android.widget.LinearLayout[1]/android.widget.LinearLayout[1]/android.widget.ScrollView[1]/android.widget.LinearLayout[1]/android.widget.LinearLayout[2]/android.widget.HorizontalScrollView[3]/android.widget.LinearLayout[1]/android.widget.FrameLayout[2]/android.widget.ImageView[1]").click() common.findID(self, self.driver, "com.jrdcom.wearable.smartband2:id/apply_button") WebDriverWait(self.driver, 100).until( lambda x: x.find_element_by_id("com.jrdcom.wearable.smartband2:id/watch_style")) for i in range(2): try: common.clickAgain(self, self.driver, ele1, ele2) common.findXpath(self, self.driver, "//android.widget.LinearLayout[1]/android.widget.FrameLayout[1]/android.widget.LinearLayout[1]/android.widget.LinearLayout[1]/android.widget.ScrollView[1]/android.widget.LinearLayout[1]/android.widget.LinearLayout[2]/android.widget.HorizontalScrollView[3]/android.widget.LinearLayout[1]/android.widget.FrameLayout[3]/android.widget.ImageView[1]").click() common.findID(self, self.driver, "com.jrdcom.wearable.smartband2:id/apply_button") WebDriverWait(self.driver, 100).until( lambda x: x.find_element_by_id("com.jrdcom.wearable.smartband2:id/watch_style")) except: common.clickAgain(self, self.driver, ele1, ele2) common.findXpath(self, self.driver, "//android.widget.LinearLayout[1]/android.widget.FrameLayout[1]/android.widget.LinearLayout[1]/android.widget.LinearLayout[1]/android.widget.ScrollView[1]/android.widget.LinearLayout[1]/android.widget.LinearLayout[2]/android.widget.HorizontalScrollView[3]/android.widget.LinearLayout[1]/android.widget.FrameLayout[4]/android.widget.ImageView[1]").click() common.findID(self, self.driver, "com.jrdcom.wearable.smartband2:id/apply_button") WebDriverWait(self.driver, 100).until( lambda x: x.find_element_by_id("com.jrdcom.wearable.smartband2:id/watch_style")) common.clickAgain(self, self.driver, ele1, ele2) common.findXpath(self, self.driver, "//android.widget.LinearLayout[1]/android.widget.FrameLayout[1]/android.widget.LinearLayout[1]/android.widget.LinearLayout[1]/android.widget.ScrollView[1]/android.widget.LinearLayout[1]/android.widget.LinearLayout[2]/android.widget.HorizontalScrollView[3]/android.widget.LinearLayout[1]/android.widget.FrameLayout[4]/android.widget.ImageView[1]").click() common.findID(self, self.driver, "com.jrdcom.wearable.smartband2:id/apply_button") WebDriverWait(self.driver, 100).until( lambda x: x.find_element_by_id("com.jrdcom.wearable.smartband2:id/watch_style")) b = b + 1 time.sleep(1) print(""" "Modern" """ "Watch face check ok.") # Diva b = 1 for a in range(3): ele1 = "//android.widget.LinearLayout[1]/android.widget.FrameLayout[1]/android.widget.RelativeLayout[1]/android.widget.RelativeLayout[2]/android.widget.GridView[1]/android.widget.FrameLayout[4]/android.widget.ImageView[1]" ele2 = "//android.widget.LinearLayout[1]/android.widget.FrameLayout[1]/android.widget.LinearLayout[1]/android.widget.LinearLayout[1]/android.widget.ScrollView[1]/android.widget.LinearLayout[1]/android.widget.LinearLayout[2]/android.widget.HorizontalScrollView[1]/android.widget.LinearLayout[1]/android.widget.FrameLayout[%s]/android.widget.ImageView[1]" % b # Wallpaper common.clickAgain(self, self.driver, ele1, ele2) common.swipeToRight(self.driver, "com.jrdcom.wearable.smartband2:id/scrollViewWatchWallpaper") time.sleep(1) common.swipeToRight(self.driver, "com.jrdcom.wearable.smartband2:id/scrollViewWatchWallpaper") time.sleep(1) common.findXpath(self, self.driver, "//android.widget.LinearLayout[1]/android.widget.FrameLayout[1]/android.widget.LinearLayout[1]/android.widget.LinearLayout[1]/android.widget.ScrollView[1]/android.widget.LinearLayout[1]/android.widget.LinearLayout[2]/android.widget.HorizontalScrollView[2]/android.widget.LinearLayout[1]/android.widget.FrameLayout[1]/android.widget.ImageView[1]").click() common.swipeUp(self.driver, "com.jrdcom.wearable.smartband2:id/scroll_view") time.sleep(1) ele = self.driver.find_element_by_id("com.jrdcom.wearable.smartband2:id/showhometime_switch") Show = ele.get_attribute("checked") try: self.assertEqual(Show, "true") print("Show Home Time is selected") except: common.findID(self, self.driver, "com.jrdcom.wearable.smartband2:id/showhometime_switch") print("BOSS,i have select it") common.findID(self, self.driver, "com.jrdcom.wearable.smartband2:id/apply_button") WebDriverWait(self.driver, 100).until( lambda x: x.find_element_by_id("com.jrdcom.wearable.smartband2:id/watch_style")) common.clickAgain(self, self.driver, ele1, ele2) common.findXpath(self, self.driver, "//android.widget.LinearLayout[1]/android.widget.FrameLayout[1]/android.widget.LinearLayout[1]/android.widget.LinearLayout[1]/android.widget.ScrollView[1]/android.widget.LinearLayout[1]/android.widget.LinearLayout[2]/android.widget.HorizontalScrollView[2]/android.widget.LinearLayout[1]/android.widget.FrameLayout[2]/android.widget.ImageView[1]").click() common.findID(self, self.driver, "com.jrdcom.wearable.smartband2:id/apply_button") WebDriverWait(self.driver, 100).until( lambda x: x.find_element_by_id("com.jrdcom.wearable.smartband2:id/watch_style")) for i in range(19): try: common.clickAgain(self, self.driver, ele1, ele2) common.findXpath(self, self.driver, "//android.widget.LinearLayout[1]/android.widget.FrameLayout[1]/android.widget.LinearLayout[1]/android.widget.LinearLayout[1]/android.widget.ScrollView[1]/android.widget.LinearLayout[1]/android.widget.LinearLayout[2]/android.widget.HorizontalScrollView[2]/android.widget.LinearLayout[1]/android.widget.FrameLayout[3]/android.widget.ImageView[1]").click() common.findID(self, self.driver, "com.jrdcom.wearable.smartband2:id/apply_button") WebDriverWait(self.driver, 100).until( lambda x: x.find_element_by_id("com.jrdcom.wearable.smartband2:id/watch_style")) except: common.clickAgain(self, self.driver, ele1, ele2) common.findXpath(self, self.driver, "//android.widget.LinearLayout[1]/android.widget.FrameLayout[1]/android.widget.LinearLayout[1]/android.widget.LinearLayout[1]/android.widget.ScrollView[1]/android.widget.LinearLayout[1]/android.widget.LinearLayout[2]/android.widget.HorizontalScrollView[2]/android.widget.LinearLayout[1]/android.widget.FrameLayout[4]/android.widget.ImageView[1]").click() common.findID(self, self.driver, "com.jrdcom.wearable.smartband2:id/apply_button") WebDriverWait(self.driver, 100).until( lambda x: x.find_element_by_id("com.jrdcom.wearable.smartband2:id/watch_style")) common.clickAgain(self, self.driver, ele1, ele2) common.findXpath(self, self.driver, "//android.widget.LinearLayout[1]/android.widget.FrameLayout[1]/android.widget.LinearLayout[1]/android.widget.LinearLayout[1]/android.widget.ScrollView[1]/android.widget.LinearLayout[1]/android.widget.LinearLayout[2]/android.widget.HorizontalScrollView[2]/android.widget.LinearLayout[1]/android.widget.FrameLayout[4]/android.widget.ImageView[1]").click() common.findID(self, self.driver, "com.jrdcom.wearable.smartband2:id/apply_button") WebDriverWait(self.driver, 100).until( lambda x: x.find_element_by_id("com.jrdcom.wearable.smartband2:id/watch_style")) # Color common.clickAgain(self, self.driver, ele1, ele2) common.swipeToRight(self.driver, "com.jrdcom.wearable.smartband2:id/scrollViewWatchColor") time.sleep(1) common.findXpath(self, self.driver, "//android.widget.LinearLayout[1]/android.widget.FrameLayout[1]/android.widget.LinearLayout[1]/android.widget.LinearLayout[1]/android.widget.ScrollView[1]/android.widget.LinearLayout[1]/android.widget.LinearLayout[2]/android.widget.HorizontalScrollView[3]/android.widget.LinearLayout[1]/android.widget.FrameLayout[1]/android.widget.ImageView[1]").click() common.findID(self, self.driver, "com.jrdcom.wearable.smartband2:id/apply_button") WebDriverWait(self.driver, 100).until( lambda x: x.find_element_by_id("com.jrdcom.wearable.smartband2:id/watch_style")) common.clickAgain(self, self.driver, ele1, ele2) common.findXpath(self, self.driver, "//android.widget.LinearLayout[1]/android.widget.FrameLayout[1]/android.widget.LinearLayout[1]/android.widget.LinearLayout[1]/android.widget.ScrollView[1]/android.widget.LinearLayout[1]/android.widget.LinearLayout[2]/android.widget.HorizontalScrollView[3]/android.widget.LinearLayout[1]/android.widget.FrameLayout[2]/android.widget.ImageView[1]").click() common.findID(self, self.driver, "com.jrdcom.wearable.smartband2:id/apply_button") WebDriverWait(self.driver, 100).until( lambda x: x.find_element_by_id("com.jrdcom.wearable.smartband2:id/watch_style")) for i in range(7): try: common.clickAgain(self, self.driver, ele1, ele2) common.findXpath(self, self.driver, "//android.widget.LinearLayout[1]/android.widget.FrameLayout[1]/android.widget.LinearLayout[1]/android.widget.LinearLayout[1]/android.widget.ScrollView[1]/android.widget.LinearLayout[1]/android.widget.LinearLayout[2]/android.widget.HorizontalScrollView[3]/android.widget.LinearLayout[1]/android.widget.FrameLayout[3]/android.widget.ImageView[1]").click() common.findID(self, self.driver, "com.jrdcom.wearable.smartband2:id/apply_button") WebDriverWait(self.driver, 100).until( lambda x: x.find_element_by_id("com.jrdcom.wearable.smartband2:id/watch_style")) except: common.clickAgain(self, self.driver, ele1, ele2) common.findXpath(self, self.driver, "//android.widget.LinearLayout[1]/android.widget.FrameLayout[1]/android.widget.LinearLayout[1]/android.widget.LinearLayout[1]/android.widget.ScrollView[1]/android.widget.LinearLayout[1]/android.widget.LinearLayout[2]/android.widget.HorizontalScrollView[3]/android.widget.LinearLayout[1]/android.widget.FrameLayout[4]/android.widget.ImageView[1]").click() common.findID(self, self.driver, "com.jrdcom.wearable.smartband2:id/apply_button") WebDriverWait(self.driver, 100).until( lambda x: x.find_element_by_id("com.jrdcom.wearable.smartband2:id/watch_style")) common.clickAgain(self, self.driver, ele1, ele2) common.findXpath(self, self.driver, "//android.widget.LinearLayout[1]/android.widget.FrameLayout[1]/android.widget.LinearLayout[1]/android.widget.LinearLayout[1]/android.widget.ScrollView[1]/android.widget.LinearLayout[1]/android.widget.LinearLayout[2]/android.widget.HorizontalScrollView[3]/android.widget.LinearLayout[1]/android.widget.FrameLayout[4]/android.widget.ImageView[1]").click() common.findID(self, self.driver, "com.jrdcom.wearable.smartband2:id/apply_button") WebDriverWait(self.driver, 100).until( lambda x: x.find_element_by_id("com.jrdcom.wearable.smartband2:id/watch_style")) b = b + 1 time.sleep(1) print(""" "Diva" """ "Watch face check ok.") # Digital b = 1 for a in range(4): ele1 = "//android.widget.LinearLayout[1]/android.widget.FrameLayout[1]/android.widget.RelativeLayout[1]/android.widget.RelativeLayout[2]/android.widget.GridView[1]/android.widget.FrameLayout[5]/android.widget.ImageView[1]" ele2 = "//android.widget.LinearLayout[1]/android.widget.FrameLayout[1]/android.widget.LinearLayout[1]/android.widget.LinearLayout[1]/android.widget.ScrollView[1]/android.widget.LinearLayout[1]/android.widget.LinearLayout[2]/android.widget.HorizontalScrollView[1]/android.widget.LinearLayout[1]/android.widget.FrameLayout[%s]/android.widget.ImageView[1]" % b # Wallpaper common.clickAgain(self, self.driver, ele1, ele2) common.swipeToRight(self.driver, "com.jrdcom.wearable.smartband2:id/scrollViewWatchWallpaper") time.sleep(1) common.swipeToRight(self.driver, "com.jrdcom.wearable.smartband2:id/scrollViewWatchWallpaper") time.sleep(1) common.findXpath(self, self.driver, "//android.widget.LinearLayout[1]/android.widget.FrameLayout[1]/android.widget.LinearLayout[1]/android.widget.LinearLayout[1]/android.widget.ScrollView[1]/android.widget.LinearLayout[1]/android.widget.LinearLayout[2]/android.widget.HorizontalScrollView[2]/android.widget.LinearLayout[1]/android.widget.FrameLayout[1]/android.widget.ImageView[1]").click() time.sleep(1) common.findID(self, self.driver, "com.jrdcom.wearable.smartband2:id/apply_button") WebDriverWait(self.driver, 100).until( lambda x: x.find_element_by_id("com.jrdcom.wearable.smartband2:id/watch_style")) common.clickAgain(self, self.driver, ele1, ele2) common.findXpath(self, self.driver, "//android.widget.LinearLayout[1]/android.widget.FrameLayout[1]/android.widget.LinearLayout[1]/android.widget.LinearLayout[1]/android.widget.ScrollView[1]/android.widget.LinearLayout[1]/android.widget.LinearLayout[2]/android.widget.HorizontalScrollView[2]/android.widget.LinearLayout[1]/android.widget.FrameLayout[2]/android.widget.ImageView[1]").click() common.findID(self, self.driver, "com.jrdcom.wearable.smartband2:id/apply_button") WebDriverWait(self.driver, 100).until( lambda x: x.find_element_by_id("com.jrdcom.wearable.smartband2:id/watch_style")) for i in range(13): try: common.clickAgain(self, self.driver, ele1, ele2) common.findXpath(self, self.driver, "//android.widget.LinearLayout[1]/android.widget.FrameLayout[1]/android.widget.LinearLayout[1]/android.widget.LinearLayout[1]/android.widget.ScrollView[1]/android.widget.LinearLayout[1]/android.widget.LinearLayout[2]/android.widget.HorizontalScrollView[2]/android.widget.LinearLayout[1]/android.widget.FrameLayout[3]/android.widget.ImageView[1]").click() common.findID(self, self.driver, "com.jrdcom.wearable.smartband2:id/apply_button") WebDriverWait(self.driver, 100).until( lambda x: x.find_element_by_id("com.jrdcom.wearable.smartband2:id/watch_style")) except: common.clickAgain(self, self.driver, ele1, ele2) common.findXpath(self, self.driver, "//android.widget.LinearLayout[1]/android.widget.FrameLayout[1]/android.widget.LinearLayout[1]/android.widget.LinearLayout[1]/android.widget.ScrollView[1]/android.widget.LinearLayout[1]/android.widget.LinearLayout[2]/android.widget.HorizontalScrollView[2]/android.widget.LinearLayout[1]/android.widget.FrameLayout[4]/android.widget.ImageView[1]").click() common.findID(self, self.driver, "com.jrdcom.wearable.smartband2:id/apply_button") WebDriverWait(self.driver, 100).until( lambda x: x.find_element_by_id("com.jrdcom.wearable.smartband2:id/watch_style")) common.clickAgain(self, self.driver, ele1, ele2) common.findXpath(self, self.driver, "//android.widget.LinearLayout[1]/android.widget.FrameLayout[1]/android.widget.LinearLayout[1]/android.widget.LinearLayout[1]/android.widget.ScrollView[1]/android.widget.LinearLayout[1]/android.widget.LinearLayout[2]/android.widget.HorizontalScrollView[2]/android.widget.LinearLayout[1]/android.widget.FrameLayout[4]/android.widget.ImageView[1]").click() common.findID(self, self.driver, "com.jrdcom.wearable.smartband2:id/apply_button") WebDriverWait(self.driver, 100).until( lambda x: x.find_element_by_id("com.jrdcom.wearable.smartband2:id/watch_style")) # Color common.clickAgain(self, self.driver, ele1, ele2) common.swipeToRight(self.driver, "com.jrdcom.wearable.smartband2:id/scrollViewWatchColor") time.sleep(1) common.findXpath(self, self.driver, "//android.widget.LinearLayout[1]/android.widget.FrameLayout[1]/android.widget.LinearLayout[1]/android.widget.LinearLayout[1]/android.widget.ScrollView[1]/android.widget.LinearLayout[1]/android.widget.LinearLayout[2]/android.widget.HorizontalScrollView[3]/android.widget.LinearLayout[1]/android.widget.FrameLayout[1]/android.widget.ImageView[1]").click() common.findID(self, self.driver, "com.jrdcom.wearable.smartband2:id/apply_button") WebDriverWait(self.driver, 100).until( lambda x: x.find_element_by_id("com.jrdcom.wearable.smartband2:id/watch_style")) time.sleep(1) common.clickAgain(self, self.driver, ele1, ele2) common.findXpath(self, self.driver, "//android.widget.LinearLayout[1]/android.widget.FrameLayout[1]/android.widget.LinearLayout[1]/android.widget.LinearLayout[1]/android.widget.ScrollView[1]/android.widget.LinearLayout[1]/android.widget.LinearLayout[2]/android.widget.HorizontalScrollView[3]/android.widget.LinearLayout[1]/android.widget.FrameLayout[2]/android.widget.ImageView[1]").click() common.findID(self, self.driver, "com.jrdcom.wearable.smartband2:id/apply_button") WebDriverWait(self.driver, 100).until( lambda x: x.find_element_by_id("com.jrdcom.wearable.smartband2:id/watch_style")) time.sleep(1) for i in range(5): try: common.clickAgain(self, self.driver, ele1, ele2) common.findXpath(self, self.driver, "//android.widget.LinearLayout[1]/android.widget.FrameLayout[1]/android.widget.LinearLayout[1]/android.widget.LinearLayout[1]/android.widget.ScrollView[1]/android.widget.LinearLayout[1]/android.widget.LinearLayout[2]/android.widget.HorizontalScrollView[3]/android.widget.LinearLayout[1]/android.widget.FrameLayout[3]/android.widget.ImageView[1]").click() common.findID(self, self.driver, "com.jrdcom.wearable.smartband2:id/apply_button") WebDriverWait(self.driver, 100).until( lambda x: x.find_element_by_id("com.jrdcom.wearable.smartband2:id/watch_style")) time.sleep(1) except: common.clickAgain(self, self.driver, ele1, ele2) common.findXpath(self, self.driver, "//android.widget.LinearLayout[1]/android.widget.FrameLayout[1]/android.widget.LinearLayout[1]/android.widget.LinearLayout[1]/android.widget.ScrollView[1]/android.widget.LinearLayout[1]/android.widget.LinearLayout[2]/android.widget.HorizontalScrollView[3]/android.widget.LinearLayout[1]/android.widget.FrameLayout[4]/android.widget.ImageView[1]").click() common.findID(self, self.driver, "com.jrdcom.wearable.smartband2:id/apply_button") WebDriverWait(self.driver, 100).until( lambda x: x.find_element_by_id("com.jrdcom.wearable.smartband2:id/watch_style")) time.sleep(1) common.clickAgain(self, self.driver, ele1, ele2) common.findXpath(self, self.driver, "//android.widget.LinearLayout[1]/android.widget.FrameLayout[1]/android.widget.LinearLayout[1]/android.widget.LinearLayout[1]/android.widget.ScrollView[1]/android.widget.LinearLayout[1]/android.widget.LinearLayout[2]/android.widget.HorizontalScrollView[3]/android.widget.LinearLayout[1]/android.widget.FrameLayout[4]/android.widget.ImageView[1]").click() common.findID(self, self.driver, "com.jrdcom.wearable.smartband2:id/apply_button") WebDriverWait(self.driver, 100).until( lambda x: x.find_element_by_id("com.jrdcom.wearable.smartband2:id/watch_style")) time.sleep(1) b = b + 1 time.sleep(1) print(""" "Digital" """ "Watch face check ok.") # Chronograph b = 1 for a in range(2): ele1 = "//android.widget.LinearLayout[1]/android.widget.FrameLayout[1]/android.widget.RelativeLayout[1]/android.widget.RelativeLayout[2]/android.widget.GridView[1]/android.widget.FrameLayout[6]/android.widget.ImageView[1]" ele2 = " //android.widget.LinearLayout[1]/android.widget.FrameLayout[1]/android.widget.LinearLayout[1]/android.widget.LinearLayout[1]/android.widget.ScrollView[1]/android.widget.LinearLayout[1]/android.widget.LinearLayout[2]/android.widget.HorizontalScrollView[1]/android.widget.LinearLayout[1]/android.widget.FrameLayout[%s]/android.widget.ImageView[1]" % b # Wallpaper common.clickAgain(self, self.driver, ele1, ele2) common.swipeToRight(self.driver, "com.jrdcom.wearable.smartband2:id/scrollViewWatchWallpaper") time.sleep(1) common.swipeToRight(self.driver, "com.jrdcom.wearable.smartband2:id/scrollViewWatchWallpaper") time.sleep(1) common.findXpath(self, self.driver, "//android.widget.LinearLayout[1]/android.widget.FrameLayout[1]/android.widget.LinearLayout[1]/android.widget.LinearLayout[1]/android.widget.ScrollView[1]/android.widget.LinearLayout[1]/android.widget.LinearLayout[2]/android.widget.HorizontalScrollView[2]/android.widget.LinearLayout[1]/android.widget.FrameLayout[1]/android.widget.ImageView[1]").click() time.sleep(1) common.findID(self, self.driver, "com.jrdcom.wearable.smartband2:id/apply_button") WebDriverWait(self.driver, 100).until( lambda x: x.find_element_by_id("com.jrdcom.wearable.smartband2:id/watch_style")) common.clickAgain(self, self.driver, ele1, ele2) common.findXpath(self, self.driver, "//android.widget.LinearLayout[1]/android.widget.FrameLayout[1]/android.widget.LinearLayout[1]/android.widget.LinearLayout[1]/android.widget.ScrollView[1]/android.widget.LinearLayout[1]/android.widget.LinearLayout[2]/android.widget.HorizontalScrollView[2]/android.widget.LinearLayout[1]/android.widget.FrameLayout[2]/android.widget.ImageView[1]").click() common.findID(self, self.driver, "com.jrdcom.wearable.smartband2:id/apply_button") WebDriverWait(self.driver, 100).until( lambda x: x.find_element_by_id("com.jrdcom.wearable.smartband2:id/watch_style")) for i in range(4): try: common.clickAgain(self, self.driver, ele1, ele2) common.findXpath(self, self.driver, "//android.widget.LinearLayout[1]/android.widget.FrameLayout[1]/android.widget.LinearLayout[1]/android.widget.LinearLayout[1]/android.widget.ScrollView[1]/android.widget.LinearLayout[1]/android.widget.LinearLayout[2]/android.widget.HorizontalScrollView[2]/android.widget.LinearLayout[1]/android.widget.FrameLayout[3]/android.widget.ImageView[1]").click() common.findID(self, self.driver, "com.jrdcom.wearable.smartband2:id/apply_button") WebDriverWait(self.driver, 100).until( lambda x: x.find_element_by_id("com.jrdcom.wearable.smartband2:id/watch_style")) except: common.clickAgain(self, self.driver, ele1, ele2) common.findXpath(self, self.driver, "//android.widget.LinearLayout[1]/android.widget.FrameLayout[1]/android.widget.LinearLayout[1]/android.widget.LinearLayout[1]/android.widget.ScrollView[1]/android.widget.LinearLayout[1]/android.widget.LinearLayout[2]/android.widget.HorizontalScrollView[2]/android.widget.LinearLayout[1]/android.widget.FrameLayout[4]/android.widget.ImageView[1]").click() common.findID(self, self.driver, "com.jrdcom.wearable.smartband2:id/apply_button") WebDriverWait(self.driver, 100).until( lambda x: x.find_element_by_id("com.jrdcom.wearable.smartband2:id/watch_style")) common.clickAgain(self, self.driver, ele1, ele2) common.findXpath(self, self.driver, "//android.widget.LinearLayout[1]/android.widget.FrameLayout[1]/android.widget.LinearLayout[1]/android.widget.LinearLayout[1]/android.widget.ScrollView[1]/android.widget.LinearLayout[1]/android.widget.LinearLayout[2]/android.widget.HorizontalScrollView[2]/android.widget.LinearLayout[1]/android.widget.FrameLayout[4]/android.widget.ImageView[1]").click() common.findID(self, self.driver, "com.jrdcom.wearable.smartband2:id/apply_button") WebDriverWait(self.driver, 100).until( lambda x: x.find_element_by_id("com.jrdcom.wearable.smartband2:id/watch_style")) # Color common.clickAgain(self, self.driver, ele1, ele2) common.swipeToRight(self.driver, "com.jrdcom.wearable.smartband2:id/scrollViewWatchColor") time.sleep(1) common.findXpath(self, self.driver, "//android.widget.LinearLayout[1]/android.widget.FrameLayout[1]/android.widget.LinearLayout[1]/android.widget.LinearLayout[1]/android.widget.ScrollView[1]/android.widget.LinearLayout[1]/android.widget.LinearLayout[2]/android.widget.HorizontalScrollView[3]/android.widget.LinearLayout[1]/android.widget.FrameLayout[1]/android.widget.ImageView[1]").click() common.findID(self, self.driver, "com.jrdcom.wearable.smartband2:id/apply_button") WebDriverWait(self.driver, 100).until( lambda x: x.find_element_by_id("com.jrdcom.wearable.smartband2:id/watch_style")) time.sleep(1) common.clickAgain(self, self.driver, ele1, ele2) common.findXpath(self, self.driver, "//android.widget.LinearLayout[1]/android.widget.FrameLayout[1]/android.widget.LinearLayout[1]/android.widget.LinearLayout[1]/android.widget.ScrollView[1]/android.widget.LinearLayout[1]/android.widget.LinearLayout[2]/android.widget.HorizontalScrollView[3]/android.widget.LinearLayout[1]/android.widget.FrameLayout[2]/android.widget.ImageView[1]").click() common.findID(self, self.driver, "com.jrdcom.wearable.smartband2:id/apply_button") WebDriverWait(self.driver, 100).until( lambda x: x.find_element_by_id("com.jrdcom.wearable.smartband2:id/watch_style")) time.sleep(1) for i in range(13): try: common.clickAgain(self, self.driver, ele1, ele2) common.findXpath(self, self.driver, "//android.widget.LinearLayout[1]/android.widget.FrameLayout[1]/android.widget.LinearLayout[1]/android.widget.LinearLayout[1]/android.widget.ScrollView[1]/android.widget.LinearLayout[1]/android.widget.LinearLayout[2]/android.widget.HorizontalScrollView[3]/android.widget.LinearLayout[1]/android.widget.FrameLayout[3]/android.widget.ImageView[1]").click() common.findID(self, self.driver, "com.jrdcom.wearable.smartband2:id/apply_button") WebDriverWait(self.driver, 100).until( lambda x: x.find_element_by_id("com.jrdcom.wearable.smartband2:id/watch_style")) time.sleep(1) except: common.clickAgain(self, self.driver, ele1, ele2) common.findXpath(self, self.driver, "//android.widget.LinearLayout[1]/android.widget.FrameLayout[1]/android.widget.LinearLayout[1]/android.widget.LinearLayout[1]/android.widget.ScrollView[1]/android.widget.LinearLayout[1]/android.widget.LinearLayout[2]/android.widget.HorizontalScrollView[3]/android.widget.LinearLayout[1]/android.widget.FrameLayout[4]/android.widget.ImageView[1]").click() common.findID(self, self.driver, "com.jrdcom.wearable.smartband2:id/apply_button") WebDriverWait(self.driver, 100).until( lambda x: x.find_element_by_id("com.jrdcom.wearable.smartband2:id/watch_style")) time.sleep(1) common.clickAgain(self, self.driver, ele1, ele2) common.findXpath(self, self.driver, "//android.widget.LinearLayout[1]/android.widget.FrameLayout[1]/android.widget.LinearLayout[1]/android.widget.LinearLayout[1]/android.widget.ScrollView[1]/android.widget.LinearLayout[1]/android.widget.LinearLayout[2]/android.widget.HorizontalScrollView[3]/android.widget.LinearLayout[1]/android.widget.FrameLayout[4]/android.widget.ImageView[1]").click() common.findID(self, self.driver, "com.jrdcom.wearable.smartband2:id/apply_button") WebDriverWait(self.driver, 100).until( lambda x: x.find_element_by_id("com.jrdcom.wearable.smartband2:id/watch_style")) time.sleep(1) b = b + 1 time.sleep(1) common.clickAgain(self, self.driver, "//android.widget.LinearLayout[1]/android.widget.FrameLayout[1]/android.widget.RelativeLayout[1]/android.widget.RelativeLayout[2]/android.widget.GridView[1]/android.widget.FrameLayout[6]/android.widget.ImageView[1]", "//android.widget.LinearLayout[1]/android.widget.FrameLayout[1]/android.widget.LinearLayout[1]/android.widget.LinearLayout[1]/android.widget.ScrollView[1]/android.widget.LinearLayout[1]/android.widget.LinearLayout[2]/android.widget.HorizontalScrollView[1]/android.widget.LinearLayout[1]/android.widget.FrameLayout[1]/android.widget.ImageView[1]") common.swipeUp(self.driver, "com.jrdcom.wearable.smartband2:id/scroll_view") common.findID(self, self.driver, "com.jrdcom.wearable.smartband2:id/more_button") common.findXpath(self, self.driver, "//android.widget.LinearLayout[1]/android.widget.FrameLayout[1]/android.widget.LinearLayout[1]/android.widget.GridView[1]/android.widget.RelativeLayout[1]/android.widget.ImageView[1]").click() common.findXpath(self, self.driver, "//android.view.View[1]/android.widget.FrameLayout[1]/android.view.View[1]/android.widget.FrameLayout[1]/android.view.View[1]/android.widget.FrameLayout[1]/android.widget.FrameLayout[1]/android.widget.RelativeLayout[2]/android.widget.RelativeLayout[3]/android.widget.LinearLayout[1]/android.widget.ImageView[1]").click() time.sleep(1) ok = WebDriverWait(self.driver, 15).until(lambda x: x.find_element_by_name("OK")) ok.click() time.sleep(1) common.findID(self, self.driver, "com.jrdcom.wearable.smartband2:id/cropButton") common.findID(self, self.driver, "com.jrdcom.wearable.smartband2:id/apply_button") WebDriverWait(self.driver, 100).until( lambda x: x.find_element_by_id("com.jrdcom.wearable.smartband2:id/watch_style")) time.sleep(1) print(""" "Chronograph and take a camera photo" """ "Watch face check ok.") except: common.take_shot(self.driver) print(common.str("测试失败")) raise Exception("Test failed")
def test_open_box(self): try: common.findXpath( self, self.driver, "//android.widget.LinearLayout[1]/android.widget.FrameLayout[1]/android.widget.LinearLayout[1]/android.support.v4.widget.DrawerLayout[1]/android.widget.LinearLayout[1]/android.widget.LinearLayout[1]/android.widget.LinearLayout[1]/android.widget.LinearLayout[2]/android.widget.LinearLayout[1]/android.widget.TextView[1]" ).click() try: self.driver.find_element_by_id("alertTitle").is_displayed() BLE = False except: BLE = True if BLE == False: self.driver.find_element_by_id("button1").click() print(unicode("打开蓝牙以连接手表", "utf-8")) else: print(unicode("蓝牙已打开", "utf-8")) #搜索指定手表60秒,并返回结果。 try: search_watch = WebDriverWait(self.driver, 60).until( lambda driver: driver.find_element_by_name(self.my_watch)) print(unicode("找到手表", "utf-8")) band = True except: band = False if band == True: search_watch.click() try: WebDriverWait( self.driver, 60).until(lambda driver: driver.find_element_by_id( "gif_view").is_displayed()) spanTF = True except: spanTF = False if spanTF: msg = "配对成功" print(unicode(msg, 'utf-8')) else: msg = "配对失败" print(unicode(msg, 'utf-8')) raise Exception("pair failed") while 1: try: self.driver.find_element_by_id("dashboard_button") a = True except: a = False if a == True: print(common.str("找到你了.小杨")) break else: common.swipeLeft(self.driver, "gif_view") continue common.findID(self, self.driver, "dashboard_button") common.findID(self, self.driver, "button1") box = self.driver.find_element_by_android_uiautomator( 'new UiSelector().text("Move")') box.click() common.findID(self, self.driver, "button1") os.system("adb shell input keyevent 4") common.findID(self, self.driver, "notifications_settings_done") else: print(unicode("搜索失败", "utf-8")) self.assertIsNotNone(search_watch) except: common.take_shot(self.driver) print(common.str("测试失败")) raise Exception("Test failed")