Пример #1
0
        """
        活动审核
        :param flag: True代表审核通过,False代表审核拒绝
        """
        self.driver.find_element_by_xpath(self.activity_audit_entrance).click()

        if not self.is_element_exist(self.refuse_button, 'xpath'):
            logging.warning('审核列表为空!')
        else:
            if flag:
                self.audit_pass()
            else:
                logging.info('========== audit_refuse ==========')

                self.driver.find_element_by_xpath(self.refuse_button).click()
                self.driver.find_element_by_id(self.comment).send_keys(
                    create_gbk(10))
                self.driver.find_element_by_xpath(self.confirm_button).click()
        self.return_index()


if __name__ == '__main__':
    driver = appium_desired()
    audit = Audit(driver)
    audit.enter_ccloud()
    audit.order_audit()
    audit.order_audit(flag=False)

    # audit.visit_audit()
    # audit.visit_audit(flag=False)
Пример #2
0
 def setUp(self):
     self.driver = appium_desired(flag=False)
Пример #3
0
    def take_screenshot(self, img_name):
        """
        获取当前屏幕的截图
        :param img_name: 截图名称
        Usage:
             device.take_screenshot('个人主页')   #实际截图保存的结果为:2018-11-28_15_24_58_个人主页.png
        """
        logging.info('========== take_screenshot ==========')

        try:
            if self.driver.current_context != 'NATIVE_APP':
                self.driver.switch_to.context('NATIVE_APP')
            day = time.strftime("%Y-%m-%d", time.localtime(time.time()))
            shot_path = "..\\Screenshots\\" + day
            shot_time = time.strftime("%Y-%m-%d_%H_%M_%S", time.localtime(time.time()))
            img_type = '.png'
            filename = shot_path + "\\" + shot_time + "_" + img_name + img_type
            if not os.path.exists(shot_path):
                os.makedirs(shot_path)
            self.driver.get_screenshot_as_file(filename)
        except Exception as e:
            logging.warning('尝试截图失败', e)


if __name__ == '__main__':
    driver = appium_desired(flag=False)
    common = Common(driver)
    common.enter_ccloud(flag=False)
    time.sleep(5)
Пример #4
0
 def setUp(self):
     self.driver = appium_desired()