Beispiel #1
0
    def pay_confirm_operate(self):
        """支付确认页 操作"""
        direct = self.direct_buy_button()  # 直接购买 按钮
        if GetAttribute().get_enabled(direct) == 'true':
            direct.click()  # 点击 直接购买 按钮

            if self.wait_check_pay_confirm_page():  # 支付确认 页面检查点
                print('------------------------------')
                print('支付确认页:')
                self.st_icon()  # 学生头像
                self.st_name()  # 学生name
                self.st_phone()  # 手机号

                self.online_services_operate()  # 在线客服

                unit = self.price_unit()  # 货币单位
                print(unit, self.price_info())  # 价格
                self.card_hint()  # 卡的类型说明

                print('-----------------')
                self.pay_type()  # 支付方式
                icon = self.pay_icon()  # icon

                wechat_check = self.wechat_pay_check()  # 微信单选框
                if GetAttribute().get_checked(wechat_check) == 'false':
                    print('❌❌❌ Error - 未默认选中 微信支付')

                for k in range(1, len(icon)):
                    self.pay_mode(k)  # 支付方式
                print('-----------------')

                self.pay_delay_tips()  # 支付延迟 说明
                self.parent_replace_operate()  # 家长代付
Beispiel #2
0
    def parent_replace_operate(self):
        """家长代付页 操作"""
        parent = self.parent_pay_check()  # 家长代付 单选框
        parent.click()
        self.confirm_pay_button()  # 确认支付 按钮
        if self.wait_check_replace_page():  # 家长代付页 检查点
            print('------------------------------')
            print('家长代付页:')

            wechat_tab = self.wechat_replace_pay()  # 微信代付
            if GetAttribute().get_selected(wechat_tab) == 'false':
                print('❌❌❌ Error - 未默认选中 微信代付')
            else:
                ali_tab = self.ali_replace_pay()  # 支付宝代付
                print(ali_tab.text)
                ali_tab.click()  # 切换到 支付宝代付
                if GetAttribute().get_selected(
                        self.ali_replace_pay()) == 'false':
                    print('❌❌❌ Error - 未选中 支付宝代付')

            self.card_type()  # 卡的类型
            unit = self.price_unit(2)  # 货币单位
            print(unit, self.price_info())  # 价格

            if self.qr_code_judge():
                self.qr_code_hint()  # xx扫描二维码付款

            if not self.pay_finish_tips():  # 支付完成 提示
                print("❌❌❌ Error - 无支付完成 提示")
            self.pay_statement()  # 收款公司说明

            self.pay_finish_operate()  # 支付结果页
 def test_medal_tip(self):
     """测试勋章弹框"""
     if self.home.wait_check_home_page():
         self.home.screen_swipe_up(0.5, 0.9, 0.2, 1000)
         self.home.check_more()[1].click()
         if self.library.wait_check_test_label_page('我的阅读'):
             self.medal.medal_icon().click()
             if self.medal.wait_check_medal_page():
                 medals = self.medal.medals()
                 for x in medals:
                     if self.medal.wait_check_medal_page():
                         if GetAttribute().get_selected(x) == 'false':
                             x.click()
                             if not self.medal.wait_check_medal_img_page():
                                 self.base_assert.except_error('点击置灰勋章未发现弹框')
                             else:
                                 print(self.medal.medal_content(), '\n')
                                 self.home.click_blank()
                         else:
                             x.click()
                             if not GameCommonEle().wait_check_punch_share_page():
                                 self.base_assert.except_error('点亮勋章点击后未进入分享页面')
                             else:
                                 GameCommonEle().share_page_operate()
                 if self.medal.wait_check_medal_page():
                     self.medal.click_back_up_button()
                 if LibraryPage().wait_check_test_label_page('我的阅读'):
                     self.medal.click_back_up_button()
                 if self.home.wait_check_home_page():
                     print('返回主页面')
Beispiel #4
0
 def question_judge(self, var):
     """元素 resource-id属性值是否为题目"""
     value = GetAttribute().get_resource_id(var)
     if value == self.id_type() + "question":
         return True
     else:
         return False
Beispiel #5
0
 def option_selected(self, index):
     """获取所有选项 - 四个选项selected属性"""
     time.sleep(1)
     ele = self.driver \
         .find_elements_by_id(self.id_type() + "tv_char")[index]
     value = GetAttribute().get_selected(ele)
     return value
Beispiel #6
0
    def next_button_judge(self, var):
        """‘下一题’按钮 状态判断"""
        item = self.driver \
            .find_element_by_id(self.id_type() + "fab_submit")  # ‘下一题’按钮
        value = GetAttribute().get_enabled(item)

        if value != var:  # 测试 下一步 按钮 状态
            print('❌❌❌ 下一步按钮 状态Error', value)
    def options_statistic(self, count):
        """选择对错统计"""
        time.sleep(1)
        ele = []  # 四个选项selected属性值为true的个数

        options = self.option_button()  # 四个选项
        for j in range(len(options)):  # 统计答案正确与否
            if GetAttribute().get_selected(options[j]) == 'true':  # 错误答案
                ele.append(j)
            if GetAttribute().get_description(options[j]) == 'true':  # 正确答案
                ele.append(j)

        if ele[0] == ele[1]:  # 如果选项的selected属性为true的作业数为1,说明答对了,则+1
            count += 1
            print('回答正确:', options[ele[0]].text)
        else:  # ele[0] != ele[1]
            print('回答错误T/F:%s、%s' %
                  (options[ele[1]].text, options[ele[0]].text))
Beispiel #8
0
 def judge_word_is_star(self, i):
     """判断单词是否被标星"""
     if GetAttribute().get_selected(
             self.star_button()) == 'true':  # 判断但是标星是否被标注
         print('单词已标星')
         if i == 3:
             self.star_button().click()  # 取消标星
     else:
         self.base_assert.except_error("❌❌❌ Error--此题未被标星")
Beispiel #9
0
 def judge_word_is_star(self, i):
     """判断单词是否被标星"""
     if GetAttribute().selected(
             self.star_button()) == 'true':  # 判断但是标星是否被标注
         print('单词已标星')
         if i == 3:
             self.click_star()  # 取消标星
     else:
         print("★★★ Error--此题未被标星")
Beispiel #10
0
    def buy_page_direct_operate(self):
        """购买页 操作 -- 直接购买"""
        if self.wait_check_pay_page():  # 购买页 检查点
            print('------------------------------')
            print('购买页:')
            self.st_icon()  # 学生头像
            self.st_name()  # 学生name
            self.st_phone()  # 手机号

            self.buy_hint()  # 购买提示
            self.hint_info()  # 提分版 权力

            self.online_services_operate()  # 在线客服

            if self.wait_check_pay_page():
                check = self.check_button()  # 单选框
                for i in range(len(check)):
                    if GetAttribute().get_checked(check[i]) == 'true':
                        if i != 3:
                            print('❌❌❌ Error - 未默认选中 年卡')
                        else:
                            check[0].click()  # 选择季卡
                            if GetAttribute().get_checked(
                                    self.check_button()[0]) == 'true':
                                self.current_card()  # 左下角 目前选中的卡
                            else:
                                print('❌❌❌ Error - 未选中 月卡')

                card = self.card_name()  # 卡的类型
                price = self.card_price()  # 卡的价格

                if len(check) != len(card) != len(price) != 4:
                    print('❌❌❌ Error - 卡的个数有误', len(check), len(card),
                          len(price))
                else:
                    print('--------------------')
                    for j in range(len(card)):
                        print(card[j].text, price[j].text)
                    print('--------------------')

                self.buy_agreement()  # 购买协议

                self.pay_confirm_operate()  # 支付确认页
Beispiel #11
0
 def setUp(cls):
     """启动应用"""
     cls.result = unittest.TestResult()
     cls.base_assert = ExpectingTest(cls, cls.result)
     cls.login = LoginPage()
     cls.home = HomePage()
     cls.van = VanclassPage()
     cls.detail = VanclassDetailPage()
     cls.get = GetAttribute()
     BasePage().set_assert(cls.base_assert)
Beispiel #12
0
    def sentence_strengthen_result_operate(self, mine_answer):
        """强化炼句结果页处理"""
        right_answer = {}
        right_count = 0
        for x in range(len(mine_answer)):
            if x != len(mine_answer) - 1:
                index_num = x + 1
            else:
                index_num = x
                self.screen_swipe_up(0.5, 0.9, 0.4, 1000)
            while not self.wait_check_sentence_container_by_content_desc(
                    index_num):
                self.screen_swipe_up(0.5, 0.9, 0.85, 500)
            mine_done_answer = mine_answer[str(x)]
            right_wrong_icon = self.group_sentence_right_wrong_icon(x)
            sentence_hint_explain = self.group_hint_explain(x)
            page_sentence_answer = self.group_answer_sentence(x)
            print('解释:', sentence_hint_explain)
            print('句子:', page_sentence_answer)

            reform_right_ans, reform_mine_ans = self.get_right_and_mine_answer(
                page_sentence_answer)
            if '(' in page_sentence_answer:
                right_answer[str(len(right_answer))] = reform_right_ans
                if mine_done_answer != reform_mine_ans:
                    self.base_assert.except_error('输入的答案与页面展示的不一致 ' +
                                                  mine_done_answer)

                if GetAttribute().get_selected(right_wrong_icon) == 'true':
                    self.base_assert.except_error('我的答案与正确答案不一致,但是图标显示正确!' +
                                                  mine_done_answer)
                else:
                    print('图标验证正确')
            else:
                right_count += 1
                if GetAttribute().get_selected(right_wrong_icon) == 'false':
                    self.base_assert.except_error('我的答案与正确答案一致,但是图标显示不正确!' +
                                                  mine_done_answer)
                else:
                    print('图标验证正确')
            print('-' * 30, '\n')
        print('错题再练答案:', right_answer)
        return right_answer, right_count, len(mine_answer)
    def sentence_listen_link_result_operate(self, mine_answer):
        """听音连句结果页处理"""
        right_answer = {}
        right_count = 0
        for x in range(len(mine_answer)):
            if x != len(mine_answer) - 1:
                index_num = x + 1
            else:
                index_num = x
                self.screen_swipe_up(0.5, 0.9, 0.4, 1000)
            while not self.wait_check_sentence_container_by_content_desc(index_num):
                self.screen_swipe_up(0.5, 0.9, 0.8, 500)
            mine_done_answer = mine_answer[str(x)]
            self.group_sentence_speck_icon(x).click()
            right_wrong_icon = self.group_sentence_right_wrong_icon(x)
            page_answer = self.group_right_answer(x).split('答案: ')[1].strip()
            page_mine_answer = self.group_mine_answer(x).split('我的: ')[1].strip()
            sentence_explain = self.group_sentence_explain(x)

            print(sentence_explain,
                  "答案:" + page_answer,
                  '我的:' + page_mine_answer,
                  sep='\n')

            if mine_done_answer != page_mine_answer:
                self.base_assert.except_error('做题答案与页面展示的不一致 ' + page_mine_answer)

            if page_answer != page_mine_answer:
                if GetAttribute().get_selected(right_wrong_icon) == 'true':
                    self.base_assert.except_error('我的答案与正确答案不一致,但是图标显示正确!' + page_answer)
                else:
                    print('图标验证正确')
                right_answer[str(len(right_answer))] = page_answer
            else:
                right_count += 1
                if GetAttribute().get_selected(right_wrong_icon) == 'false':
                    self.base_assert.except_error('我的答案与正确答案一致,但是图标显示不正确!' + page_answer)
                else:
                    print('图标验证正确')
            print('-'*30, '\n')
        print('错题再练答案:', right_answer)
        return right_answer, right_count, len(mine_answer)
Beispiel #14
0
    def reading_operate(self):
        """《阅读理解》 游戏过程"""
        if self.wait_check_page():
            if self.wait_check_play_page():
                timestr = []  # 获取每小题的时间

                drag = self.dragger()  # 拖动按钮
                loc = self.get_element_bounds(drag)  # 获取按钮坐标
                size = self.options_view_size()  # 获取整个选项页面大小
                self.driver.swipe(loc[2], loc[3], loc[2], loc[3] + size-10, 1000)  # 拖拽按钮到最底部,以便测试Aa

                self.font_operate()  # Aa文字大小切换按钮 状态判断 及 切换操作

                loc = self.get_element_bounds(drag)  # 获取按钮坐标
                y = loc[3] - size * 4 / 3
                if loc[3] - size * 4 / 3 < 0:
                    y = 0
                self.driver.swipe(loc[2], loc[3], loc[2], y, 1000)  # 向上拖拽

                rate = self.rate()
                for i in range(int(rate)):
                    Homework().rate_judge(rate, i)  # 测试当前rate值显示是否正确
                    Homework().next_button_operate('false')  # 下一题 按钮 状态判断 加点击

                    question = self.question_num().text  # 题目
                    if i != 0:
                        for step in range(0, 5):
                            if int(self.get_first_num()) == i+1:  # 正好
                                question = self.question_num().text
                                break
                            elif int(self.get_first_num()) > i+1:  # 上拉拉过了
                                self.screen_swipe_down(0.5, 0.7, 0.9, 1000)
                                if int(self.get_first_num()) == i+1:  # 正好
                                    question = self.question_num().text
                                    break
                                elif int(self.get_first_num()) < i+1:  # 下拉拉过了
                                    self.screen_swipe_up(0.5, 0.9, 0.8, 1000)  # 滑屏

                    options = self.option_button(question)
                    options[0][random.randint(0, len(options[0])) - 1].click()  # 随机点击选项
                    time.sleep(1)
                    for j in range(len(options[0])):
                        if GetAttribute().get_selected(options[1][j]) == 'true':
                            print('我的答案:', options[1][j].text)
                            break

                    if i != int(rate) - 1:
                        self.screen_swipe_up(0.5, 0.9, 0.5, 1000)

                    timestr.append(self.time())  # 统计每小题的计时控件time信息
                    print('---------------------------')

                Homework().next_button_operate('true')  # 下一题 按钮 状态判断 加点击
                Homework().now_time(timestr)  # 判断游戏界面 计时功能控件 是否在计时
    def sentence_change_result_operate(self, mine_answer):
        """句型转换结果页处理"""
        right_answer = {}
        right_count = 0
        for x in range(len(mine_answer)):
            if x != len(mine_answer) - 1:
                index_num = x + 1
            else:
                index_num = x
                self.screen_swipe_up(0.5, 0.9, 0.4, 1000)
            while not self.wait_check_sentence_container_by_content_desc(
                    index_num):
                self.screen_swipe_up(0.5, 0.9, 0.85, 500)
            mine_done_answer = mine_answer[str(x)]
            right_wrong_icon = self.group_sentence_right_wrong_icon(x)
            sentence_question = self.group_question(x)
            page_answer = self.group_answer_sentence(x)
            page_mine_answer = self.group_mine_answer(x)
            print(sentence_question, '\n', "答案:", page_answer, '\n', '我的:',
                  page_mine_answer)
            if mine_done_answer != page_mine_answer:
                self.base_assert.except_error('做题答案与页面展示的不一致 ' +
                                              page_mine_answer)

            if page_answer != page_mine_answer:
                if GetAttribute().get_selected(right_wrong_icon) == 'true':
                    self.base_assert.except_error('我的答案与正确答案不一致,但是图标显示正确!' +
                                                  page_answer)
                else:
                    print('图标验证正确')
                right_answer[str(len(right_answer))] = page_answer
            else:
                right_count += 1
                if GetAttribute().get_selected(right_wrong_icon) == 'false':
                    self.base_assert.except_error('我的答案与正确答案一致,但是图标显示不正确!' +
                                                  page_answer)
                else:
                    print('图标验证正确')
            print('-' * 30, '\n')
        print('错题再练答案:', right_answer)
        return right_answer, right_count, len(mine_answer)
    def image_choice_result_operate(self, mine_answer=None):
        """听音选图结果页面处理"""
        right_answer = {}
        right_count = 0
        for x in range(len(mine_answer)):
            if x == len(mine_answer) - 1:
                index_num = x + 1
                self.screen_swipe_up(0.5, 0.9, 0.4, 1000)
            else:
                index_num = x + 2

            while not self.wait_check_ques_text_by_index(index_num):
                self.screen_swipe_up(0.5, 0.9, 0.8, 500)
            question = self.get_ques_text_by_index(str(x + 1))
            print('问题:', question)
            images = self.get_images_by_index(x)
            mine_done_answer = mine_answer[str(x)]
            print('我的答案:', mine_done_answer)
            for img in images:
                img_content = img.get_attribute('contentDescription')
                if mine_done_answer in img_content:
                    if GetAttribute().get_selected(img) == 'false':
                        self.base_assert.except_error('选择答案后,结果页显示未选中')
                    if 'true' in img_content:
                        print('正确答案:', img_content)
                        right_answer[str(
                            len(right_answer))] = img_content.split(
                                '##')[0].strip()
                        right_count += 1
                else:
                    if GetAttribute().get_selected(img) == 'true':
                        self.base_assert.except_error('未选此选项,结果页显示被选中')

                    if 'true' in img_content:
                        print('正确答案:', img_content)
                        right_answer[str(
                            len(right_answer))] = img_content.split(
                                '##')[0].strip()
            print('-' * 30, '\n')
        print('再练一遍答案:', right_answer)
        return right_answer, right_count, len(mine_answer)
    def flash_copy_game_operate(
        self,
        fq,
        half_exit,
        star_list=None,
    ):
        star_words = [] if fq == 1 else star_list
        if self.wait_check_copy_page():
            total_num = self.rest_bank_num()
            for x in range(total_num):
                self.click_voice()
                self.rate_judge(total_num, x)
                copy_word = self.copy_word()
                print('单词:', copy_word)
                if half_exit:
                    if x == 1:
                        self.click_back_up_button()
                        self.tips_operate()
                        break

                if x % 2 == 0:  # 奇数题
                    if fq == 1:  # 若为第一次
                        self.star_button().click()  # 标星
                        star_words.append(copy_word)
                        print('加入标星单词')
                    else:  # 若为第二次 校验是否被标星
                        if GetAttribute().get_selected(
                                self.star_button()) == 'true':
                            print('标星校验正确')
                        else:
                            self.base_assert.except_error('单词已标星但标星按钮未被选中')

                self.copy_input().click()
                time.sleep(1)
                if x == 1:
                    random_str = random.sample(string.ascii_lowercase,
                                               4)  # 随机输入错误单词,
                    for j, s in enumerate(random_str):
                        Keyboard().keyboard_operate(s, j)
                    print('输入单词:', ''.join(random_str))

                    if self.copy_word() != copy_word:  # 验证是否跳转到下一题
                        self.base_assert.except_error('输入错误单词可以进入下一题')

                    for y in range(4):  # 清除输入的单词
                        Keyboard().games_keyboard('backspace')
                    time.sleep(1)

                for j, s in enumerate(list(copy_word)):  # 输入抄写单词
                    Keyboard().keyboard_operate(s, j)
                time.sleep(3)
                print('-' * 30, '\n')
            return total_num, star_words
    def hint_ele_operate(self, value):
        self.next_btn_judge('false', self.fab_commit_btn)  # 下一题 按钮 判断加 点击操作
        if self.wait_check_tv_word_or_random_page():  # 默写模式 - 字母未全部消除
            print('❌❌❌ Error - 单词拼写 默写模式 - 字母未全部消除')

        hint = self.hint_btn()  # 提示按钮
        if GetAttribute().get_enabled(hint) == 'true':
            hint.click()  # 点击 提示按钮
            if GetAttribute().get_enabled(self.hint_btn()) != 'false':
                print('❌❌❌ Error - 点击后提示按钮enabled属性错误')

            if self.wait_check_tv_word_or_random_page():  # 出现首字母提示
                first_word = self.spell_word().text[::2]
                if first_word == value[0]:
                    print('点击提示出现首字母提示', first_word)
                else:
                    print('点击提示出现首字母提示', first_word)
            else:
                print("❌❌❌ Error - 首字母提示未出现")
        else:
            print('❌❌❌ Error - 提示按钮enabled属性错误')
    def word_game_result_check_operate(self, mine_answer):
        """单词类游戏结果页处理"""
        right_answer = {}
        right_count = 0
        value_is_explain = self.value_is_explain(mine_answer)
        for x in range(len(mine_answer)):
            if x != len(mine_answer) - 1:
                index_num = x + 1
            else:
                index_num = x
                self.screen_swipe_up(0.5, 0.9, 0.4, 1000)
            while not self.wait_check_word_container_by_index_and_id(
                    index_num):
                self.screen_swipe_up(0.5, 0.9, 0.85, 500)
            result_explain = self.group_explain(x)
            result_word = self.group_word(x)
            result_word_voice = self.group_word_voice(x)
            result_icon = self.group_right_wong_icon(x)
            check_answer = result_explain if value_is_explain else result_word
            print('解释:', result_explain)
            print('单词:', result_word)

            result_word_voice.click()

            if mine_answer[str(x)].lower() != check_answer.lower():
                if GetAttribute().get_selected(result_icon) == 'true':
                    self.base_assert.except_error('单词与我输入的不一致,但图标显示正确\n')
                else:
                    print('图标标识正确\n')
                right_answer[str(len(right_answer))] = check_answer
            else:
                right_count += 1
                if GetAttribute().get_selected(result_icon) == 'false':
                    self.base_assert.except_error('单词与我输入一致,但图标显示错误\n')
                else:
                    print('图标标识正确\n')
        print('错题再练答案:', right_answer)
        return right_answer, right_count, len(mine_answer)
    def flash_card_game_operate(self, fq, half_exit, star_list=None):
        """图书馆、作业内闪卡游戏过程"""
        star_words = [] if fq == 1 else star_list
        if self.wait_check_flash_study_page():
            total_num = self.rest_bank_num()
            for x in range(0, total_num):
                self.rate_judge(total_num, x)  # 待完成数校验
                self.next_btn_judge('true', self.fab_next_btn)  # 下一步按钮状态检验
                self.click_voice()
                word = self.study_word()
                print('单词:', word)

                if half_exit:
                    if x == 1:
                        self.click_back_up_button()
                        self.tips_operate()

                if not self.wait_check_explain_page():  # 验证页面是否默认选择英汉模式
                    self.base_assert.except_error('未发现单词解释,页面没有默认选择英汉模式' +
                                                  word)
                else:
                    print('解释:', self.study_word_explain().text)  # 单词解释

                if self.wait_check_sentence_page():
                    print("句子:", self.study_sentence())  # 句子
                    print("句子解释:", self.study_sentence_explain())  # 句子解释
                    print("推荐老师:", self.author())  # 推荐老师

                self.change_model_btn().click()  # 切换全英模式
                if self.wait_check_explain_page():  # 校验翻译是否出现
                    self.base_assert.except_error('切换至全英模式依然存在解释' + word)

                self.change_model_btn().click()  # 切换回英汉模式

                if x % 2 == 0:  # 第一次,部分单词点击标星按钮
                    if fq == 1:
                        self.star_button().click()
                        star_words.append(word)
                        print('加入标星单词')
                    else:
                        if GetAttribute().get_selected(
                                self.star_button()) == 'true':
                            print('标星校验正确')
                        else:
                            self.base_assert.except_error('单词已标星但标星按钮未被选中')

                print('-' * 20, '\n')
                self.fab_next_btn().click()
                time.sleep(2)
            return total_num, star_words
Beispiel #21
0
 def judge_word_is_familiar(self, familiar, word, i, familiar_add):
     """判断单词是否被标熟"""
     if word in familiar:
         if GetAttribute().get_selected(self.familiar_button()) == 'true':
             self.base_assert.except_error("❌❌❌ Error-- 此题未被标熟")
             self.familiar_button().click()
             self.tips_operate()
             familiar_add.append(word)
         else:
             print('单词已标熟')
     else:
         if i == 2 or i == 4:
             self.familiar_button().click()
             self.tips_operate()
             familiar_add.append(word)
Beispiel #22
0
 def judge_word_is_familiar(self, familiar, word, i, familiar_add):
     """判断单词是否被标熟"""
     if word in familiar:
         if GetAttribute().selected(self.familiar_button()) == 'true':
             print("★★★ Error-- 此题未被标熟")
             self.click_familiar()
             self.tips_operate()
             familiar_add.append(word)
         else:
             print('单词已标熟')
     else:
         if i == 2 or i == 4:
             self.click_familiar()
             self.tips_operate()
             familiar_add.append(word)
Beispiel #23
0
    def result_img(self):
        """图片 选项"""
        ele = self.driver \
            .find_elements_by_xpath("//android.support.v7.widget.RecyclerView/*")  # 包括 句子+选项

        count = []
        option = []
        for i in range(len(ele)):
            if GetAttribute().get_class_name(
                    ele[i]) == 'android.widget.LinearLayout':
                count.append(i)

        count.append(len(ele))
        for j in range(len(count) - 1):
            option.append(count[j + 1] - count[j] - 1)
        return option
    def cancel_or_add_star(self, total, star_words, cancel=False):
        """添加或取消标星"""
        word_list = []
        while True:
            words = self.result_words()
            for i, w in enumerate(words):
                if w.text in word_list:
                    continue
                else:
                    if i == len(words) - 1:
                        self.screen_swipe_up(0.5, 0.8, 0.72, 1000)
                    result_word = w.text
                    word_list.append(result_word)
                    voice_btn = self.word_voice(
                        result_word) or self.sentence_voice(result_word)
                    voice_btn.click()
                    word_explain = self.word_explain(
                        result_word) or self.sentence_explain(result_word)
                    word_star = self.word_star(
                        result_word) or self.sentence_star(result_word)

                    if cancel:
                        print('单词:', result_word)
                        print('解释', word_explain.text)
                        if GetAttribute().get_selected(word_star) == 'true':
                            word_star.click()
                            print('取消标星')
                            star_words.remove(result_word)
                        print('-' * 20, '\n')
                    else:
                        if i == 2 or i == 4:
                            print('单词:', result_word, end='\t')
                            word_star.click()
                            print('添加标星')
                            star_words.append(result_word)
                            print('-' * 20, '\n')

            if len(word_list) != total:
                self.screen_swipe_up(0.5, 0.8, 0.3, 1000)
            else:
                break
        self.screen_swipe_down(0.5, 0.2, 0.8, 1000)
Beispiel #25
0
    def check_position_change(self):
        if self.wait_check_keyboard_page():
            self.hide_keyboard_btn().click()

        self.screen_swipe_down(0.5, 0.2, 0.9, 1000)
        if GetAttribute().get_checked(self.font_large()) == 'false':
            self.base_assert.except_error('页面未默认选择中等字体')

        # 依次点击Aa,并获取第一个填空的X轴位置,比较大小
        large_size = self.rich_text().size

        self.font_middle().click()
        time.sleep(1)
        middle_size = self.rich_text().size

        self.font_great().click()
        time.sleep(1)
        great_size = self.rich_text().size

        if large_size['height'] < middle_size['height']:
            self.base_assert.except_error('大字体变中等字体未发生变化')
        if great_size['height'] < large_size['height']:
            self.base_assert.except_error('超大字变大字体未发生变化')
    def word_match_result_operate(self, mine_answer):
        """连连看结果页处理"""
        for x in range(len(mine_answer)):
            if x != len(mine_answer) - 1:
                index_num = x + 1
            else:
                index_num = x
                self.screen_swipe_up(0.5, 0.9, 0.4, 1000)
            while not self.wait_check_word_container_by_index_and_id(
                    index_num):
                self.screen_swipe_up(0.5, 0.9, 0.85, 500)
            result_explain = self.group_explain(x)
            result_word = self.group_word(x)
            self.group_word_voice(x).click()
            result_icon = self.group_right_wong_icon(x)
            print('解释:', result_explain)
            print('单词:', result_word)

            if GetAttribute().get_selected(result_icon) == 'false':
                self.base_assert.except_error('单词判断状态为错误!' + result_word)
            else:
                print('图标标识正确\n')

        return {}, len(mine_answer), len(mine_answer)
Beispiel #27
0
 def __init__(self):
     self.get = GetAttribute()
Beispiel #28
0
 def __init__(self):
     self.result = ResultPage()
     self.get = GetAttribute()
     self.key = Keyboard()
 def result_mine(self, index):
     """我的"""
     ele = self.driver \
         .find_elements_by_id(self.id_type() + "iv_mine")[index]
     value = GetAttribute().get_selected(ele)
     return value
Beispiel #30
0
 def __init__(self):
     self.attr = GetAttribute()
     self.homework = Homework()
     self.mysql = MysqlData()
     self.common = DataActionPage()