def uploadMusicByOneselfClassr(self):
     driver = self.driver
     sleep(2)
     now = time.strftime('%Y-%m-%d %H_%M_%S')
     print('\n032:进入教室自主上传乐谱----开始:' + now)
     login(self)
     sleep(2)
     lis1 = driver.find_elements_by_android_uiautomator(
         'new UiSelector().text("本日暂时没有课程安排")')
     if len(lis1) != 0:
         for i in range(6):
             bu = driver.find_elements_by_id(
                 'com.pnlyy.pnlclass_teacher.test:id/courseCountTv')[i + 1]
             if (bu.text != '0'):
                 bu.click()
                 sleep(2)
                 #历史课单 middle
                 driver.find_elements_by_android_uiautomator(
                     'new UiSelector().text("进入教室")')[0].click()
                 sleep(5)
                 break
     else:
         driver.swipe(1000, 1600, 1000, 1100, 1000)
         sleep(2)
         driver.find_elements_by_android_uiautomator(
             'new UiSelector().text("进入教室")')[1].click()
         sleep(5)
     allow = driver.find_elements_by_android_uiautomator(
         'new UiSelector().text("始终允许")')
     if len(allow) != 0:
         driver.find_element_by_android_uiautomator(
             'new UiSelector().text("始终允许")').click()
         sleep(5)
     driver.find_element_by_android_uiautomator(
         'new UiSelector().text("查看上课乐谱")').click()
     sleep(2)
     o = driver.find_elements_by_android_uiautomator(
         'new UiSelector().text("好")')
     if len(o) != 0:
         driver.find_element_by_android_uiautomator(
             'new UiSelector().text("好")').click()
         sleep(2)
     now = time.strftime('%Y-%m-%d %H_%M_%S')
     sf0 = './' + now + '_032b_checkClassSheet_R.png'
     driver.get_screenshot_as_file(sf0)
     sleep(2)
     #com.pnlyy.pnlclass_teacher.test:id/rightTv
     items = driver.find_elements_by_id(
         'com.pnlyy.pnlclass_teacher.test:id/tvName')
     i = len(items)
     print('\nitems:' + str(i))
     sleep(1)
     if i == 0:
         print('本节课暂未上传乐谱')
         sleep(1)
     else:
         for j in range(i - 1):
             driver.find_element_by_android_uiautomator(
                 'new UiSelector().text("删除")').click()
             sleep(2)
             driver.find_element_by_android_uiautomator(
                 'new UiSelector().text("确定")').click()
             sleep(2)
         driver.find_element_by_android_uiautomator(
             'new UiSelector().text("上传乐谱")').click()
         sleep(3)
         driver.find_element_by_android_uiautomator(
             'new UiSelector().text("自主上传")').click()
         sleep(3)
         driver.find_element_by_android_uiautomator(
             'new UiSelector().text("取消")').click()
         sleep(3)
         driver.find_element_by_android_uiautomator(
             'new UiSelector().text("自主上传")').click()
         sleep(3)
         driver.find_element_by_android_uiautomator(
             'new UiSelector().text("最近上过的乐谱")').click()
         sleep(3)
         add = driver.find_elements_by_android_uiautomator(
             'new UiSelector().text("添加")')
         if len(add) != 0:
             driver.find_element_by_android_uiautomator(
                 'new UiSelector().text("添加")').click()
             sleep(2)
         else:
             print('\n没有最近乐谱')
             sleep(1)
         driver.find_element_by_android_uiautomator(
             'new UiSelector().text("返回")').click()
         sleep(2)
         driver.find_element_by_android_uiautomator(
             'new UiSelector().text("返回")').click()
         sleep(2)
         now = time.strftime('%Y-%m-%d %H_%M_%S')
         sf0 = './' + now + '_032b_uploadedMusicBybefore_R.png'
         driver.get_screenshot_as_file(sf0)
         sleep(2)
         driver.find_elements_by_id(
             'com.pnlyy.pnlclass_teacher.test:id/tvName')[0].click()
         sleep(10)
         now = time.strftime('%Y-%m-%d %H_%M_%S')
         sf1 = './' + now + '_032b_uploadedMusicByAlbeforeDetail_R.png'
         driver.get_screenshot_as_file(sf1)
         sleep(2)
         turnpage_play(self)
         sleep(2)
         driver.find_element_by_android_uiautomator(
             'new UiSelector().text("乐谱库")').click()
         sleep(3)
         driver.find_element_by_android_uiautomator(
             'new UiSelector().text("上传乐谱")').click()
         sleep(3)
         driver.find_element_by_android_uiautomator(
             'new UiSelector().text("自主上传")').click()
         sleep(3)
         driver.find_element_by_android_uiautomator(
             'new UiSelector().text("从相册选择")').click()
         sleep(3)
         #com.pnlyy.pnlclass_teacher.test:id/indexTv
         driver.find_elements_by_id(
             'com.pnlyy.pnlclass_teacher.test:id/indexTv')[3].click()
         sleep(3)
         driver.find_element_by_android_uiautomator(
             'new UiSelector().text("完成")').click()
         sleep(6)
         now = time.strftime('%Y-%m-%d %H_%M_%S')
         sf2 = './' + now + '_032b_uploadedMusicByAlbum_R.png'
         driver.get_screenshot_as_file(sf2)
         sleep(2)
         driver.find_elements_by_id(
             'com.pnlyy.pnlclass_teacher.test:id/tvName')[1].click()
         sleep(10)
         now = time.strftime('%Y-%m-%d %H_%M_%S')
         sf2 = './' + now + '_032b_uploadedMusicByAlbumDetail_R.png'
         driver.save_screenshot(sf2)
         sleep(2)
         driver.find_element_by_android_uiautomator(
             'new UiSelector().text("乐谱库")').click()
         sleep(3)
         driver.find_element_by_android_uiautomator(
             'new UiSelector().text("上传乐谱")').click()
         sleep(3)
         driver.find_element_by_android_uiautomator(
             'new UiSelector().text("自主上传")').click()
         sleep(3)
         driver.find_element_by_android_uiautomator(
             'new UiSelector().text("拍照上传")').click()
         sleep(3)
         #com.huawei.camera:id/shutter_button
         driver.find_element_by_id(
             'com.huawei.camera:id/shutter_button').click()
         sleep(2)
         #com.huawei.camera:id/btn_review_confirm
         driver.find_element_by_id(
             'com.huawei.camera:id/btn_review_confirm').click()
         sleep(2)
         driver.find_element_by_android_uiautomator(
             'new UiSelector().text("完成")').click()
         sleep(6)
         now = time.strftime('%Y-%m-%d %H_%M_%S')
         sf4 = './' + now + '_032b_uploadedMusicBySelfie_R.png'
         driver.get_screenshot_as_file(sf4)
         sleep(2)
         driver.find_elements_by_id(
             'com.pnlyy.pnlclass_teacher.test:id/tvName')[2].click()
         sleep(8)
         now = time.strftime('%Y-%m-%d %H_%M_%S')
         sf5 = './' + now + '_032b_uploadedMusicBySelfieDetail_R.png'
         driver.get_screenshot_as_file(sf5)
         sleep(2)
         driver.find_element_by_android_uiautomator(
             'new UiSelector().text("乐谱库")').click()
         sleep(3)
         now = time.strftime('%Y-%m-%d %H_%M_%S')
         sf6 = './' + now + '_032b_afterUploadedMusic_R.png'
         driver.get_screenshot_as_file(sf6)
         sleep(2)
     driver.find_element_by_android_uiautomator(
         'new UiSelector().text("返回")').click()
     sleep(2)
     #退出
     driver.find_element_by_android_uiautomator(
         'new UiSelector().text("退出")').click()
     sleep(3)
     driver.find_element_by_android_uiautomator(
         'new UiSelector().text("其他原因退出")').click()
     sleep(3)
     logout(self)
     now = time.strftime('%Y-%m-%d %H_%M_%S')
     print('\n032:进入教室自主上传乐谱----结束:' + now)
     sleep(1)
Пример #2
0
 def searchAddMusicClassroom(self):
     driver = self.driver
     sleep(2)
     now = time.strftime('%Y-%m-%d %H_%M_%S')
     print('\n033:进入教室搜索添加乐谱----开始:' + now)
     login(self)
     sleep(2)
     lis1 = driver.find_elements_by_android_uiautomator(
         'new UiSelector().text("本日暂时没有课程安排")')
     if len(lis1) != 0:
         for i in range(6):
             bu = driver.find_elements_by_id(
                 'com.pnlyy.pnlclass_teacher.test:id/courseCountTv')[i + 1]
             if (bu.text != '0'):
                 bu.click()
                 sleep(2)
                 #历史课单 middle
                 #driver.swipe(1000,1600,1000,1100,1000)
                 #sleep(2)
                 driver.find_elements_by_android_uiautomator(
                     'new UiSelector().text("进入教室")')[0].click()
                 sleep(5)
                 break
     else:
         driver.swipe(1000, 1600, 1000, 1100, 1000)
         sleep(2)
         driver.find_elements_by_android_uiautomator(
             'new UiSelector().text("进入教室")')[1].click()
         sleep(5)
     allow = driver.find_elements_by_android_uiautomator(
         'new UiSelector().text("始终允许")')
     if len(allow) != 0:
         driver.find_element_by_android_uiautomator(
             'new UiSelector().text("始终允许")').click()
         sleep(3)
     driver.find_element_by_android_uiautomator(
         'new UiSelector().text("查看上课乐谱")').click()
     sleep(2)
     driver.find_element_by_android_uiautomator(
         'new UiSelector().text("上传乐谱")').click()
     sleep(2)
     driver.find_element_by_android_uiautomator(
         'new UiSelector().text("搜索书名或曲目名")').click()
     sleep(2)
     #考级
     driver.find_element_by_android_uiautomator(
         'new UiSelector().text("考级")').click()
     sleep(2)
     driver.find_element_by_android_uiautomator(
         'new UiSelector().text("钢琴")').click()
     sleep(2)
     driver.find_element_by_android_uiautomator(
         'new UiSelector().text("小提琴")').click()
     sleep(2)
     driver.find_element_by_android_uiautomator(
         'new UiSelector().text("手风琴")').click()
     sleep(2)
     driver.find_element_by_android_uiautomator(
         'new UiSelector().text("古筝")').click()
     sleep(2)
     driver.find_element_by_id(
         'com.pnlyy.pnlclass_teacher.test:id/tvMusicBookName').click()
     sleep(2)
     driver.find_element_by_id(
         'com.pnlyy.pnlclass_teacher.test:id/lookMusicScoreLl').click()
     sleep(3)
     turnpage_play(self)
     sleep(2)
     now = time.strftime('%Y-%m-%d %H_%M_%S')
     sf2 = './' + now + '_033b_searchedMusicByHotDetail_R.png'
     driver.get_screenshot_as_file(sf2)
     sleep(2)
     driver.find_element_by_android_uiautomator(
         'new UiSelector().text("乐谱库")').click()
     sleep(2)
     driver.find_element_by_id(
         'com.pnlyy.pnlclass_teacher.test:id/leftTv').click()
     sleep(2)
     driver.find_element_by_android_uiautomator(
         'new UiSelector().text("取消")').click()
     sleep(2)
     driver.find_element_by_android_uiautomator(
         'new UiSelector().text("全部")').click()
     sleep(2)
     driver.find_element_by_android_uiautomator(
         'new UiSelector().text("搜索书名或曲目名")').click()
     sleep(2)
     #keyword
     s = driver.find_element_by_id(
         'com.pnlyy.pnlclass_teacher.test:id/etSearch2')
     s.click()
     s.set_value('299 No.07')
     sleep(1)
     #enter key=66
     driver.press_keycode(66)
     sleep(4)
     driver.find_element_by_android_uiautomator(
         'new UiSelector().text("包含该曲目")').click()
     sleep(2)
     driver.find_element_by_id(
         'com.pnlyy.pnlclass_teacher.test:id/lookMusicScoreLl').click()
     sleep(3)
     now = time.strftime('%Y-%m-%d %H_%M_%S')
     sf0 = './' + now + '_033b_searchedMusicByKeywordDetail_R.png'
     driver.get_screenshot_as_file(sf0)
     sleep(2)
     turnpage_play(self)
     sleep(2)
     driver.find_element_by_android_uiautomator(
         'new UiSelector().text("乐谱库")').click()
     sleep(2)
     driver.find_element_by_id(
         'com.pnlyy.pnlclass_teacher.test:id/leftTv').click()
     sleep(2)
     driver.find_element_by_android_uiautomator(
         'new UiSelector().text("返回")').click()
     sleep(2)
     driver.find_element_by_android_uiautomator(
         'new UiSelector().text("返回")').click()
     sleep(3)
     driver.find_element_by_android_uiautomator(
         'new UiSelector().text("退出")').click()
     sleep(2)
     driver.find_element_by_android_uiautomator(
         'new UiSelector().text("其他原因退出")').click()
     sleep(3)
     driver.find_element_by_android_uiautomator(
         'new UiSelector().text("个人中心")').click()
     sleep(3)
     driver.swipe(1000, 1600, 1000, 1100, 1000)
     sleep(2)
     driver.find_element_by_android_uiautomator(
         'new UiSelector().text("退出登录")').click()
     sleep(2)
     driver.find_element_by_android_uiautomator(
         'new UiSelector().text("确定")').click()
     sleep(2)
     now = time.strftime('%Y-%m-%d %H_%M_%S')
     print('\n033:进入教室搜索添加乐谱----结束:' + now)
     sleep(1)
 def bottomMusic(self):
     driver = self.driver
     sleep(2)
     now = time.strftime('%Y-%m-%d %H_%M_%S')
     print('\n017:乐谱库----开始:' + now)
     login(self)
     sleep(2)
     driver.find_element_by_android_uiautomator(
         'new UiSelector().text("乐谱库")').click()
     sleep(2)
     now = time.strftime('%Y-%m-%d %H_%M_%S')
     sf0 = './' + now + '_017b_allMusic_R.png'
     driver.get_screenshot_as_file(sf0)
     sleep(2)
     driver.find_element_by_android_uiautomator(
         'new UiSelector().text("钢琴")').click()
     sleep(2)
     now = time.strftime('%Y-%m-%d %H_%M_%S')
     sf1 = './' + now + '_017b_Music_P_R.png'
     driver.get_screenshot_as_file(sf1)
     sleep(2)
     driver.find_element_by_android_uiautomator(
         'new UiSelector().text("小提琴")').click()
     sleep(2)
     now = time.strftime('%Y-%m-%d %H_%M_%S')
     sf2 = './' + now + '_017b_Music_V_R.png'
     driver.get_screenshot_as_file(sf2)
     sleep(2)
     driver.find_element_by_android_uiautomator(
         'new UiSelector().text("手风琴")').click()
     sleep(2)
     now = time.strftime('%Y-%m-%d %H_%M_%S')
     sf3 = './' + now + '_017b_Music_hand_R.png'
     driver.get_screenshot_as_file(sf3)
     sleep(2)
     #can see this menu
     driver.find_element_by_android_uiautomator(
         'new UiSelector().text("古筝")').click()
     sleep(2)
     now = time.strftime('%Y-%m-%d %H_%M_%S')
     sf4 = './' + now + '_017b_Music_hand_old.png'
     driver.get_screenshot_as_file(sf4)
     sleep(2)
     """
     driver.find_element_by_android_uiautomator('new UiSelector().text("钢琴")').click()
     sleep(2)
     """
     driver.find_element_by_id(
         'com.pnlyy.pnlclass_teacher.test:id/tvMusicBookName').click()
     sleep(2)
     driver.find_element_by_id(
         'com.pnlyy.pnlclass_teacher.test:id/lookMusicScoreLl').click()
     sleep(3)
     turnpage_play(self)
     sleep(2)
     now = time.strftime('%Y-%m-%d %H_%M_%S')
     sf2 = './' + now + '_017b_musicDetail_R.png'
     driver.get_screenshot_as_file(sf2)
     sleep(2)
     driver.find_element_by_android_uiautomator(
         'new UiSelector().text("乐谱库")').click()
     sleep(2)
     driver.find_element_by_id(
         'com.pnlyy.pnlclass_teacher.test:id/leftTv').click()
     sleep(2)
     logout(self)
     now = time.strftime('%Y-%m-%d %H_%M_%S')
     print('\n017:乐谱库----结束:' + now)
     sleep(1)
 def uploadMusicFromClassroom(self):
     driver = self.driver
     sleep(2)
     now = time.strftime('%Y-%m-%d %H_%M_%S')
     print('\n013:进入教室上传乐谱----开始:' + now)
     login(self)
     sleep(2)
     lis1 = driver.find_elements_by_android_uiautomator(
         'new UiSelector().text("本日暂时没有课程安排")')
     if len(lis1) != 0:
         for i in range(6):
             bu = driver.find_elements_by_id(
                 'com.pnlyy.pnlclass_teacher.test:id/courseCountTv')[i + 1]
             if (bu.text != '0'):
                 bu.click()
                 sleep(2)
                 #历史课单 middle
                 driver.find_elements_by_android_uiautomator(
                     'new UiSelector().text("进入教室")')[0].click()
                 sleep(5)
                 break
     else:
         driver.swipe(1000, 1600, 1000, 1100, 1000)
         sleep(2)
         driver.find_elements_by_android_uiautomator(
             'new UiSelector().text("进入教室")')[1].click()
         sleep(5)
     allow = driver.find_elements_by_android_uiautomator(
         'new UiSelector().text("始终允许")')
     if len(allow) != 0:
         driver.find_element_by_android_uiautomator(
             'new UiSelector().text("始终允许")').click()
         sleep(5)
     driver.find_element_by_android_uiautomator(
         'new UiSelector().text("查看上课乐谱")').click()
     sleep(2)
     o = driver.find_elements_by_android_uiautomator(
         'new UiSelector().text("好")')
     if len(o) != 0:
         driver.find_element_by_android_uiautomator(
             'new UiSelector().text("好")').click()
         sleep(2)
     now = time.strftime('%Y-%m-%d %H_%M_%S')
     sf0 = './' + now + '_013b_checkClassSheet_R.png'
     driver.get_screenshot_as_file(sf0)
     sleep(2)
     driver.find_element_by_android_uiautomator(
         'new UiSelector().text("上传乐谱")').click()
     sleep(3)
     driver.find_element_by_android_uiautomator(
         'new UiSelector().text("搜索书名或曲目名")').click()
     sleep(2)
     driver.find_element_by_android_uiautomator(
         'new UiSelector().text("车尔尼")').click()
     sleep(3)
     driver.find_element_by_android_uiautomator(
         'new UiSelector().text("钢琴")').click()
     sleep(2)
     driver.find_element_by_android_uiautomator(
         'new UiSelector().text("包含该曲目")').click()
     sleep(2)
     driver.find_element_by_android_uiautomator(
         'new UiSelector().text("添加")').click()
     sleep(2)
     driver.find_element_by_id(
         'com.pnlyy.pnlclass_teacher.test:id/leftTv').click()
     sleep(2)
     driver.find_element_by_android_uiautomator(
         'new UiSelector().text("返回")').click()
     sleep(2)
     now = time.strftime('%Y-%m-%d %H_%M_%S')
     sf1 = './' + now + '_013b_afterUploadedMusic_R.png'
     driver.get_screenshot_as_file(sf1)
     sleep(2)
     driver.find_element_by_id(
         'com.pnlyy.pnlclass_teacher.test:id/tvTitle').click()
     sleep(6)
     turnpage_play(self)
     sleep(2)
     now = time.strftime('%Y-%m-%d %H_%M_%S')
     sf2 = './' + now + '_013b_uploadedMusicDetail_R.png'
     driver.get_screenshot_as_file(sf2)
     sleep(2)
     driver.find_element_by_android_uiautomator(
         'new UiSelector().text("乐谱库")').click()
     sleep(2)
     driver.find_element_by_android_uiautomator(
         'new UiSelector().text("返回")').click()
     sleep(2)
     driver.find_element_by_android_uiautomator(
         'new UiSelector().text("退出")').click()
     sleep(3)
     driver.find_element_by_android_uiautomator(
         'new UiSelector().text("其他原因退出")').click()
     sleep(3)
     logout(self)
     now = time.strftime('%Y-%m-%d %H_%M_%S')
     print('\n013:进入教室上传乐谱----结束:' + now)
     sleep(1)
Пример #5
0
 def searchMusic(self):
     driver=self.driver
     sleep(2)
     now=time.strftime('%Y-%m-%d %H_%M_%S')
     print('\n003:搜索乐谱并播放或查看----开始:'+now)
     login(self)
     sleep(2)
     driver.find_element_by_android_uiautomator('new UiSelector().text("乐谱库")').click()
     sleep(2)
     driver.find_element_by_android_uiautomator('new UiSelector().text("搜索书名或曲目名")').click()
     sleep(2)
     #考级
     driver.find_element_by_android_uiautomator('new UiSelector().text("考级")').click()
     sleep(2)
     driver.find_element_by_android_uiautomator('new UiSelector().text("钢琴")').click()
     sleep(2)
     driver.find_element_by_android_uiautomator('new UiSelector().text("小提琴")').click()
     sleep(2)
     driver.find_element_by_android_uiautomator('new UiSelector().text("手风琴")').click()
     sleep(2)
     driver.find_element_by_android_uiautomator('new UiSelector().text("古筝")').click()
     sleep(2)
     driver.find_element_by_id('com.pnlyy.pnlclass_teacher.test:id/tvMusicBookName').click()
     sleep(2)
     driver.find_element_by_id('com.pnlyy.pnlclass_teacher.test:id/lookMusicScoreLl').click()
     sleep(3)
     turnpage_play(self)
     sleep(2)
     now=time.strftime('%Y-%m-%d %H_%M_%S')
     sf2='./'+now+'_003b_searchedMusicByHotDetail_R.png'
     driver.get_screenshot_as_file(sf2)
     sleep(2)
     driver.find_element_by_android_uiautomator('new UiSelector().text("乐谱库")').click()
     sleep(2)
     driver.find_element_by_id('com.pnlyy.pnlclass_teacher.test:id/leftTv').click()
     sleep(2)
     driver.find_element_by_android_uiautomator('new UiSelector().text("取消")').click()
     sleep(2)
     driver.find_element_by_android_uiautomator('new UiSelector().text("全部")').click()
     sleep(2)
     driver.find_element_by_android_uiautomator('new UiSelector().text("搜索书名或曲目名")').click()
     sleep(2)
     #keyword
     s=driver.find_element_by_id('com.pnlyy.pnlclass_teacher.test:id/etSearch2')
     s.click()
     s.set_value('299 No.07')
     sleep(1)
     #enter key=66
     driver.press_keycode(66)
     sleep(4)
     driver.find_element_by_android_uiautomator('new UiSelector().text("包含该曲目")').click()
     sleep(2)
     driver.find_element_by_id('com.pnlyy.pnlclass_teacher.test:id/lookMusicScoreLl').click()
     sleep(3)
     now=time.strftime('%Y-%m-%d %H_%M_%S')
     sf0='./'+now+'_003b_searchedMusicByKeywordDetail_R.png'
     driver.get_screenshot_as_file(sf0)
     sleep(2)
     turnpage_play(self)
     sleep(2)
     driver.find_element_by_android_uiautomator('new UiSelector().text("乐谱库")').click()
     sleep(2)
     driver.find_element_by_id('com.pnlyy.pnlclass_teacher.test:id/leftTv').click()
     sleep(2)
     driver.find_element_by_android_uiautomator('new UiSelector().text("取消")').click()
     sleep(2)
     logout(self)
     now=time.strftime('%Y-%m-%d %H_%M_%S')
     print('\n003:搜索乐谱并播放或查看----结束:'+now)
     sleep(1)
Пример #6
0
 def uploadMusic(self):
     driver = self.driver
     sleep(2)
     now = time.strftime('%Y-%m-%d %H_%M_%S')
     print('\n005:上传乐谱----开始:' + now)
     login(self)
     sleep(2)
     lis1 = driver.find_elements_by_android_uiautomator(
         'new UiSelector().text("本日暂时没有课程安排")')
     if len(lis1) != 0:
         for i in range(6):
             bu = driver.find_elements_by_id(
                 'com.pnlyy.pnlclass_teacher.test:id/courseCountTv')[i + 1]
             if (bu.text != '0'):
                 bu.click()
                 sleep(2)
                 #历史课单 middle
                 driver.find_element_by_android_uiautomator(
                     'new UiSelector().text("查看乐谱")').click()
                 sleep(2)
                 break
     else:
         driver.find_element_by_android_uiautomator(
             'new UiSelector().text("查看乐谱")').click()
         sleep(2)
     now = time.strftime('%Y-%m-%d %H_%M_%S')
     sf0 = './' + now + '_005b_beforeUploadedMusic_R.png'
     driver.get_screenshot_as_file(sf0)
     sleep(2)
     #com.pnlyy.pnlclass_teacher.test:id/rightTv
     driver.find_element_by_android_uiautomator(
         'new UiSelector().text("上传乐谱")').click()
     sleep(2)
     driver.find_element_by_android_uiautomator(
         'new UiSelector().text("钢琴")').click()
     sleep(2)
     driver.find_element_by_android_uiautomator(
         'new UiSelector().text("搜索书名或曲目名")').click()
     sleep(2)
     driver.find_element_by_android_uiautomator(
         'new UiSelector().text("车尔尼")').click()
     sleep(3)
     driver.find_element_by_android_uiautomator(
         'new UiSelector().text("包含该曲目")').click()
     sleep(2)
     driver.find_element_by_android_uiautomator(
         'new UiSelector().text("添加")').click()
     sleep(2)
     driver.find_element_by_id(
         'com.pnlyy.pnlclass_teacher.test:id/leftTv').click()
     sleep(2)
     driver.find_element_by_id(
         'com.pnlyy.pnlclass_teacher.test:id/leftTv').click()
     sleep(2)
     now = time.strftime('%Y-%m-%d %H_%M_%S')
     sf1 = './' + now + '_005b_afterUploadedMusic_R.png'
     driver.get_screenshot_as_file(sf1)
     sleep(2)
     driver.find_element_by_id(
         'com.pnlyy.pnlclass_teacher.test:id/tvTitle').click()
     sleep(6)
     turnpage_play(self)
     sleep(2)
     now = time.strftime('%Y-%m-%d %H_%M_%S')
     sf2 = './' + now + '_005b_uploadedMusicDetail_R.png'
     driver.get_screenshot_as_file(sf2)
     sleep(2)
     driver.find_element_by_android_uiautomator(
         'new UiSelector().text("乐谱库")').click()
     sleep(2)
     driver.find_element_by_id(
         'com.pnlyy.pnlclass_teacher.test:id/leftTv').click()
     sleep(2)
     logout(self)
     now = time.strftime('%Y-%m-%d %H_%M_%S')
     print('\n005:上传乐谱----结束:' + now)
     sleep(1)
Пример #7
0
 def checkSearchMusic(self):
     driver = self.driver
     sleep(2)
     now = time.strftime('%Y-%m-%d %H_%M_%S')
     print('\n004:查看乐谱及搜索乐谱----开始:' + now)
     login(self)
     sleep(2)
     lis1 = driver.find_elements_by_android_uiautomator(
         'new UiSelector().text("本日暂时没有课程安排")')
     if len(lis1) != 0:
         for i in range(6):
             bu = driver.find_elements_by_id(
                 'com.pnlyy.pnlclass_teacher.test:id/courseCountTv')[i + 1]
             if (bu.text != '0'):
                 bu.click()
                 sleep(2)
                 #历史课单 middle
                 driver.find_element_by_android_uiautomator(
                     'new UiSelector().text("查看乐谱")').click()
                 sleep(2)
                 break
     else:
         driver.find_element_by_android_uiautomator(
             'new UiSelector().text("查看乐谱")').click()
         sleep(2)
     now = time.strftime('%Y-%m-%d %H_%M_%S')
     sf0 = './' + now + '_004b_checkMusic_R.png'
     driver.save_screenshot(sf0)
     sleep(2)
     driver.find_element_by_android_uiautomator(
         'new UiSelector().text("上传乐谱")').click()
     sleep(2)
     #hot search
     driver.find_element_by_android_uiautomator(
         'new UiSelector().text("搜索书名或曲目名")').click()
     sleep(2)
     driver.find_element_by_android_uiautomator(
         'new UiSelector().text("考级")').click()
     sleep(3)
     driver.find_element_by_android_uiautomator(
         'new UiSelector().text("钢琴")').click()
     sleep(3)
     driver.find_element_by_android_uiautomator(
         'new UiSelector().text("小提琴")').click()
     sleep(3)
     driver.find_element_by_android_uiautomator(
         'new UiSelector().text("手风琴")').click()
     sleep(3)
     driver.find_element_by_android_uiautomator(
         'new UiSelector().text("古筝")').click()
     sleep(3)
     driver.find_element_by_id(
         'com.pnlyy.pnlclass_teacher.test:id/tvMusicBookName').click()
     sleep(3)
     driver.find_element_by_id(
         'com.pnlyy.pnlclass_teacher.test:id/lookMusicScoreLl').click()
     sleep(3)
     now = time.strftime('%Y-%m-%d %H_%M_%S')
     sf2 = './' + now + '_004b_searchedMusicByHotDetail_R.png'
     driver.get_screenshot_as_file(sf2)
     sleep(1)
     turnpage_play(self)
     sleep(1)
     driver.find_element_by_id(
         'com.pnlyy.pnlclass_teacher.test:id/leftTv').click()
     sleep(2)
     driver.find_element_by_id(
         'com.pnlyy.pnlclass_teacher.test:id/leftTv').click()
     sleep(2)
     driver.find_element_by_android_uiautomator(
         'new UiSelector().text("取消")').click()
     sleep(2)
     driver.find_element_by_android_uiautomator(
         'new UiSelector().text("全部")').click()
     sleep(2)
     #whole music name
     driver.find_element_by_android_uiautomator(
         'new UiSelector().text("搜索书名或曲目名")').click()
     sleep(2)
     #com.pnlyy.pnlclass_teacher.test:id/etSearch2
     s = driver.find_element_by_id(
         'com.pnlyy.pnlclass_teacher.test:id/etSearch2')
     s.click()
     #can't input chinese characters now
     """
     s.set_value('车尔尼299 No.02')
     sleep(1)
     driver.press_keycode(66)
     sleep(4)
     driver.find_element_by_android_uiautomator('new UiSelector().text("包含该曲目")').click()
     sleep(2)
     driver.find_element_by_id('com.pnlyy.pnlclass_teacher.test:id/lookMusicScoreLl').click()
     sleep(3)
     now=time.strftime('%Y-%m-%d %H_%M_%S')
     sf1='./'+now+'_004b_searchedMusicByWholenameDetail_R.png'
     driver.get_screenshot_as_file(sf1)
     sleep(2)
     turnpage_play(self)
     sleep(1)
     driver.find_element_by_id('com.pnlyy.pnlclass_teacher.test:id/leftTv').click()
     sleep(2)
     driver.find_element_by_id('com.pnlyy.pnlclass_teacher.test:id/leftTv').click()
     sleep(2)
     driver.find_element_by_android_uiautomator('new UiSelector().text("取消")').click()
     sleep(2)
     driver.find_element_by_android_uiautomator('new UiSelector().text("全部")').click()
     sleep(2)
     #keyword
     s=driver.find_element_by_id('com.pnlyy.pnlclass_teacher.test:id/etSearch2')
     s.click()
     """
     s.set_value('299 No.05')
     sleep(1)
     #enter key=66
     driver.press_keycode(66)
     sleep(4)
     driver.find_element_by_android_uiautomator(
         'new UiSelector().text("包含该曲目")').click()
     sleep(2)
     driver.find_element_by_id(
         'com.pnlyy.pnlclass_teacher.test:id/lookMusicScoreLl').click()
     sleep(3)
     now = time.strftime('%Y-%m-%d %H_%M_%S')
     sf0 = './' + now + '_004b_searchedMusicByKeywordDetail_R.png'
     driver.get_screenshot_as_file(sf0)
     sleep(2)
     turnpage_play(self)
     sleep(1)
     driver.find_element_by_id(
         'com.pnlyy.pnlclass_teacher.test:id/leftTv').click()
     sleep(2)
     driver.find_element_by_id(
         'com.pnlyy.pnlclass_teacher.test:id/leftTv').click()
     sleep(2)
     driver.find_element_by_android_uiautomator(
         'new UiSelector().text("取消")').click()
     sleep(2)
     driver.find_element_by_android_uiautomator(
         'new UiSelector().text("返回")').click()
     sleep(2)
     driver.find_element_by_android_uiautomator(
         'new UiSelector().text("返回")').click()
     sleep(2)
     logout(self)
     now = time.strftime('%Y-%m-%d %H_%M_%S')
     print('\n004:查看乐谱及搜索乐谱----结束:' + now)
     sleep(1)