예제 #1
0
    def get_img(self, p_list, sd, ed):
        """截图,并处理图片文件"""
        with open(join(JS_PATH, 'e_qq_pagenum.js'), 'r') as p:
            pjs = p.read()
        for e in p_list:
            if not e.get('has_data'):
                continue
            picname = '%(productId)s_%(productName)s_%(sd)s_%(ed)s.png' % {
                'productId': e.get('pid'),
                'productName': e.get('pname'),
                'sd': sd,
                'ed': ed
            }
            url = 'https://e.qq.com/atlas/%s/report/order?ptype=20&pid=%s&pname=%s' % (
                self.uid, e.get('pid'), quote(e.get('pname')))
            self.d.get(url)
            time.sleep(0.5)
            if page_version == 'new':  # 版本判断
                try:
                    self.wait_element(By.CLASS_NAME, 'button-more').click()
                except:
                    self.d.execute_script(
                        "document.querySelector('.button-more').click()")
            else:
                self.wait_element(By.LINK_TEXT,
                                  '查看报表',
                                  ec=EC.presence_of_element_located).click()
            time.sleep(2)

            # if page_version != 'new':
            #     u.pag.hotkey('ctrl', '-', interval=0.3)
            # 调整分页数量
            self.d.execute_script(pjs)
            time.sleep(1.5)
            self.d.switch_to.frame(
                self.d.find_element_by_css_selector(
                    '.splitview-tabs-body iframe'))
            # 获取高度
            get_height = 'return a=document.querySelector("#content").offsetHeight'
            height = self.d.execute_script(get_height)
            # 截图
            cut_res = cut_img(height, self.dir_path, picname)
            if not cut_res['succ']:
                logger.error('get img %s_%s failed-------msg: %s' %
                             (e['pid'], e['pname'], cut_res['msg']))
            logger.info('height: %s ---picname: %s' % (height, picname))
            # 恢复
            # u.pag.hotkey('ctrl', '0', interval=0.3)
        else:
            return {'succ': True}
예제 #2
0
 def get_img(self, sd, ed, app):
     url = 'http://appunion.2345.com/index.php?c=exp&a=index&applist=%s&start_date=%s&end_date=%s' % (
         app, sd, ed)
     self.d.get(url)
     self.d.implicitly_wait(10)
     self.d.find_element_by_id('curapp').click()
     app_name = self.d.find_element_by_css_selector('#apps li[key="%s"] a' %
                                                    app).text
     self.d.execute_script('document.querySelector("body").click()')
     pic_name = '%s_%s_%s.png' % (app_name, sd, ed)
     height = self.d.execute_script('return a=document.body.offsetHeight')
     cut_res = cut_img(height, self.dir_path, pic_name)
     if not cut_res.get('succ'):
         logger.error('got pic failed  ---  pic_name: %s' % pic_name)
     logger.info('got an pic: %s' % pic_name)
     return {'succ': True}
예제 #3
0
    def getImg(self, channel_list):
        """截图,并处理图片文件"""
        self.d.get('http://op.open.qq.com/game_channel/atistic')
        self.d.implicitly_wait(10)
        self.wait_element(By.CSS_SELECTOR, '#game-data-table td')
        try:
            mths, dates = u.make_dates(ys=None, ms=None, ye=None, me=None)
            for sd, ed in dates:
                self.setDate(sd, ed)
                for channel in channel_list:
                    self.d.execute_script(
                        'document.documentElement.scrollTop=0')
                    self.d.find_element_by_xpath(
                        '//*[@class="ui-select"]/a').click()
                    time.sleep(0.5)
                    self.d.find_element_by_xpath(
                        '//*[@class="ui-select"]//li[@data-value="%s"]/a' %
                        channel.get('channel_id')).click()
                    searchbtn = self.d.find_element_by_css_selector(
                        '.j-main-search')
                    searchbtn.click()
                    self.d.implicitly_wait(15)
                    self.wait_element(By.CSS_SELECTOR, '#game-data-table td')

                    pic_name = '%s_%s_%s.png' % (channel.get('channel_name'),
                                                 sd, ed)
                    time.sleep(2)  # 等待数据完整之后再计算整个高度
                    height = self.d.execute_script(r'''
                        var stys = window.getComputedStyle(document.body);
                        var pt = parseFloat(stys.paddingTop.replace('px', ''));
                        var pb = parseFloat(stys.paddingBottom.replace('px', ''));
                        return document.body.offsetHeight + pt + pb
                    ''')
                    cut_res = cut_img(height, self.dir_path, pic_name)
                    if not cut_res['succ']:
                        logger.error(
                            'cut picture failed, possible msg:\ndir_path:%s\npic_name: %s'
                            % (self.dir_path, pic_name))
                    logger.info('got a picture: pic_msg: %s' %
                                os.path.join(self.dir_path, pic_name))
                    time.sleep(2)
            else:
                return {'succ': True, 'msg': 'img got success'}
        except Exception as e:
            logger.error(e, exc_info=1)
            return {'succ': False, 'msg': e}
예제 #4
0
 def get_img(self, ca, pname, sd, ed, special_account=None):
     url = 'https://developer.huawei.com/consumer/cn/service/apcs/app/memberCenter.html?customerAccountId=%s#/myReport/app-promote' % ca
     self.d.get(url)
     # 更新日期
     # self.update_date_use_js(sd, ed)
     # self.update_date_click_version(sd, ed)
     self.d.implicitly_wait(10)
     print(sd, ed)
     old_name = pname
     if special_account:
         print('=================================================\n')
         pname = '%s&%s' % (pname, special_account[0]
                            )  # 正常情况自动点击,非正常情况需要手动选日期
         input(
             'please choose these selection then press enter to continue:\n%s'
             % special_account[0])
     last_mth_date_xpath = "/html/body/main/section/div/div/div/section/section[1]/div/div[4]/ul/li[1]"
     # this_month_xpath = '/html/body/main/section/div/div/div/section/section[1]/div/div[4]/ul/li[3]'
     if not special_account:
         self.d.find_element_by_xpath(last_mth_date_xpath).click()
         # self.d.find_element_by_xpath(this_month_xpath).click()
         # 点击查询
         query_xpath = "//section[@class='apppromote-report section section-filled report-filter ng-isolate-scope " \
                       "ng-dirty ng-valid ng-valid-parse']//a[@class='btn btn-primary btn-small mr-2 ng-scope'][1]"
         self.d.find_element_by_xpath(query_xpath).click()
     hjs = 'return h = document.body.offsetHeight'
     height = self.d.execute_script(hjs)
     pic_name = '%(childAcc)s_%(pname)s_%(sd)s_%(ed)s.png' % {
         'childAcc': ca,
         'pname': pname.strip(),
         'sd': sd,
         'ed': ed
     }
     cut_res = cut_img(height, self.dir_path, pic_name)
     if not cut_res['succ']:
         logger.error('get img %s failed-------msg: %s' %
                      (pic_name, cut_res.get('msg')))
     logger.info('height: %s ---picname: %s' % (height, pic_name))
     if special_account:
         special_account.remove(special_account[0])
         return self.get_img(ca,
                             old_name,
                             sd,
                             ed,
                             special_account=special_account)
     return cut_res
예제 #5
0
 def get_img(self, sd, ed):
     self.switch_frame('conFrame')
     self.change_date(sd, ed)
     pic_name = '%s_%s' % (sd, ed)
     self.d.switch_to.default_content()
     height = self.d.execute_script(
         'return document.querySelector("frameset").offsetHeight')
     if height < 964:
         height = None
     cut_res = cut_img(height, self.dir_path, pic_name)
     if not cut_res.get('succ'):
         logger.error(
             'cut picture failed, possible msg:\ndir_path:%s\npic_name: %s'
             % (self.dir_path, pic_name))
     logger.info('got a picture: pic_msg: %s' %
                 os.path.join(self.dir_path, pic_name))
     self.switch_frame('I1')
예제 #6
0
    def get_img(self, data):
        for channel in data.get('data'):
            change_select = """
document.querySelector('#s2id_query_channel a span').textContent= '%s';
document.querySelector('#query_channel').value= '%s';""" % (channel, channel)
            self.d.execute_script(change_select)
            self.wait_element(By.ID, 'btn-search').click()
            time.sleep(0.5)
            pic_name = '%s_%s_%s.png' % (channel, data.get('sd'),
                                         data.get('id'))
            height = self.d.execute_script("return document.body.offsetHeight")
            cut_res = cut_img(height, self.dir_path, pic_name)
            if not cut_res.get('succ'):
                logger.warning(
                    'got img failed --- named : %s\ndetail msg: %s' %
                    (pic_name, cut_res.get('msg')))
            logger.info('got an img: %s' % pic_name)
            self.d.execute_script('document.documentElement.scrollTop=0')
예제 #7
0
 def get_img(self, sd, ed, channels):
     channels = [] if not channels else channels
     for c in channels:
         self.d.find_element_by_class_name(
             'ant-select-search__field__wrap').click()
         hotkey('ctrl', 'a')
         typewrite(c.get('Name'))
         self.d.find_element_by_class_name('ant-btn-primary').click()
         self.d.implicitly_wait(5)
         time.sleep(1)
         # while True:
         self.d.execute_script(
             'document.querySelector("#root").scrollTop = 0')
         pic_name = '%s_%s_%s.png' % (c.get('Name'), sd, ed)
         height = self.d.execute_script(
             'return a=document.body.offsetHeight')
         cut_res = cut_img(height, self.dir_path, pic_name)
         if not cut_res.get('succ'):
             logger.error('got pic failed  ---  pic_name: %s' % pic_name)
예제 #8
0
 def get_img(self, sd, ed, identity=None, company=None, pname=None):
     """截图,并处理图片文件"""
     # 截图
     if not pname:
         pname = '%(childAcc)s_#%(company)s_#%(sd)s_#%(ed)s.png' % {
             'childAcc': identity,
             'company': company.strip(),
             'sd': sd,
             'ed': ed
         }
     else:
         pname = 'planName_#%s_#%s_#%s.png' % (pname, sd, ed)
     picname = join(self.dir_path, pname)
     cut_res = cut_img(None, self.dir_path, picname)
     if not cut_res.get('succ'):
         logger.error(cut_res.get('msg'))
         return {'succ': False}
     logger.info('got a pic: pic_name: %s' % picname)
     return {'succ': True}
예제 #9
0
    def get_img(self, sd, ed, cname):
        """截图操作"""
        # 转到目标页
        url = 'https://cpd.vivo.com.cn/bplantdata/pageDataReport.action'
        self.d.get(url)
        # 更新日期
        self.wait_element(By.ID, 'startDate')
        self.update_date_use_js(sd, ed)

        # 截图
        if not cname:
            cname = self.acc
        pic_name = '%s_%s_%s.png' % (cname, sd, ed)
        cut_res = cut_img(None, self.dir_path, pic_name)
        if not cut_res['succ']:
            logger.error('get img %s failed-------msg: %s' %
                         (pic_name, cut_res.get('msg')))
        logger.info('got a picture ---picname: %s' % pic_name)
        return cut_res
예제 #10
0
 def get_img(self, sd, ed):
     # 报表部分
     url = 'http://can.cmcm.com/report/index.html'
     self.d.get(url)
     self.d.implicitly_wait(10)
     self.change_date(sd, ed)
     pic_name = f'{sd}_{ed}.png'
     self.wait_element(By.CSS_SELECTOR,
                       '.tablesorter-headerRow',
                       ec=EC.presence_of_element_located)
     height = self.d.execute_script(
         'return a=document.querySelector("#reportTableWrapper table").offsetHeight + document.body.offsetHeight'
     )
     cut_res = cut_img(height, self.dir_path, pic_name)
     if not cut_res.get('succ'):
         logger.error('got pic failed  ---  pic_name: %s' % pic_name)
     logger.info('got an pic: %s' % pic_name)
     self.d.refresh()
     return {'succ': True}
예제 #11
0
    def get_img_part(self, get_data_res=None, **kwargs):
        # 截图
        for d in get_data_res.get('msg'):
            sd, ed = d.get('date')
            self.d.get('https://e.qq.com/atlas/%s/report/producttype' % self.uid)
            self.change_date(sd, ed)
            total_pic_name = 'total_%s_%s.png' % (sd, ed)  # pic1 , 总消耗页面截图
            logger.info('start to cut img')
            cut_res = cut_img(None, self.dir_path, total_pic_name)
            if not cut_res['succ']:
                logger.error(cut_res['msg'])

            for dt in d.get('data'):
                if dt.get('has_data'):
                    try:
                        self.get_img(dt, sd, ed)
                    except Exception as ei:
                        logger.warning('get img failed!!   pic_msg: %s~%s -- %s' % (sd, ed, dt))
                        logger.error(ei, exc_info=1)
        return {'succ': True}
예제 #12
0
 def get_img_process(self, sd, ed):
     self.change_date(sd, ed)
     total_page = self.d.find_elements_by_class_name(
         'page_pre')[-1].get_attribute('href')
     index = total_page[total_page.rfind('page'):]
     total_page = int(index[index.rfind('=') + 1:])
     for p in range(total_page):
         img_name = '%s_%s_p%s.png' % (sd, ed, p + 1)
         cut_res = cut_img(None, self.dir_path, img_name)
         if not cut_res['succ']:
             logger.error('get img %s failed-------msg: %s' %
                          (img_name, cut_res.get('msg')))
         logger.info('got img: --- picname: %s' % img_name)
         try:
             self.d.find_elements_by_class_name('page_pre')[-2].click()
         except:
             continue
     else:
         self.d.switch_to.default_content()
     return {'succ': True}
예제 #13
0
 def get_img(self, sd, ed):
     url = 'http://union.m.37.com/union_data/channel_data/'
     self.d.get(url)
     self.d.execute_script(
         '''document.querySelector("input[name='sDate']").value="%s"''' %
         sd)
     self.d.execute_script(
         '''document.querySelector("input[name='eDate']").value="%s"''' %
         ed)
     self.d.execute_script('document.querySelector(".btn.green").click()')
     pic_name = '%s_%s.png' % (sd, ed)
     height = self.d.execute_script(r'return document.body.offsetHeight')
     cut_res = cut_img(height, self.dir_path, pic_name)
     if not cut_res['succ']:
         logger.error(
             'cut picture failed, possible msg:\ndir_path:%s\npic_name: %s'
             % (self.dir_path, pic_name))
     logger.info('got a picture: pic_msg: %s' %
                 os.path.join(self.dir_path, pic_name))
     return cut_res
예제 #14
0
 def get_img(self, sd, ed, data):
     for k, v in data.get('appDict').items():
         for i, s in data.get('typeDict').items():
             url = 'http://cpbi.ijinshan.com/?begin=%s&app=%s&end=%s&type=%s&c=user&a=' % (
                 sd, k, ed, i)
             self.d.get(url)
             try:
                 self.d.execute_script(
                     "document.querySelector('#bar_1').click()")
             except Exception:
                 pass
             self.d.execute_script('document.documentElement.scrollTop=0')
             pic_name = '%s_%s_%s_%s.png' % (v, s, sd, ed)
             height = self.d.execute_script(
                 "return document.body.offsetHeight")
             cut_res = cut_img(height, self.dir_path, pic_name)
             if not cut_res.get('succ'):
                 logger.warning(
                     'got img failed --- named : %s\ndetail msg: %s' %
                     (pic_name, cut_res.get('msg')))
             logger.info('got an img: %s' % pic_name)
             self.d.execute_script('document.documentElement.scrollTop=0')
예제 #15
0
 def get_img(self, start, end):
     heads = 'http://ad.wkanx.com/#/ader/report/list?dateRange=%s,%s&order=desc&orderBy=date%s&dimension=date'
     scroll_to_top = 'var q=document.documentElement.scrollTop=0'
     get_height = 'return a=document.body.offsetHeight'
     url = heads % (start, end, '&pageNo=1')
     self.d.get(url)
     # 回到顶部
     try:
         self.d.execute_script(scroll_to_top)
     except:
         self.d.refresh()
         self.d.implicitly_wait(5)
         self.d.execute_script(scroll_to_top)
     # 获取高度
     height = self.d.execute_script(get_height) + 300
     time.sleep(3)
     pic_name = os.path.join(self.dir_path, '%s_%s.png' % (start, end))
     res = cut_img(height, self.dir_path, pic_name)
     if not res.get('succ'):
         logger.warning('got picture failed: %s' % pic_name)
     logger.info('got a picture: %s' % pic_name)
     return {'succ': True}
예제 #16
0
    def get_img(self, sd, ed):
        """截图操作"""
        # 更新日期
        self.update_date_use_js(sd, ed)
        # 选择总消耗
        select_spend = """document.querySelector('div.selectDiv.noInit .hide.cl li[data-id="1"]').click()"""
        self.d.execute_script(select_spend)
        time.sleep(2)

        # 显示产品图标
        pname = self.d.find_element_by_css_selector('span.icon.fr')
        pname_location = [pname.location.get('x'), pname.location.get('y')]
        u.pag.moveTo(x=pname_location[0], y=pname_location[1] + 110)

        # 截图
        hjs = 'return h = document.body.offsetHeight'
        height = self.d.execute_script(hjs)
        pic_name = '%(sd)s_%(ed)s.png' % {'sd': sd, 'ed': ed}
        cut_res = cut_img(None, self.dir_path, pic_name)
        if not cut_res['succ']:
            logger.error('get img %s failed-------msg: %s' %
                         (pic_name, cut_res.get('msg')))
        logger.info('height: %s ---picname: %s' % (height, pic_name))
        return cut_res
예제 #17
0
 def getImg(self, sd, ed):
     self.d.execute_script("document.querySelector('#start').value='%s'" %
                           sd)
     self.d.execute_script("document.querySelector('#end').value='%s'" % ed)
     self.d.execute_script("document.querySelector('#query1').click()")
     self.d.find_element_by_css_selector('.mutl-select-trigger').click()
     channels_ele = self.d.find_elements_by_css_selector('.checkbox-inline')
     channels = [x.text.strip() for x in channels_ele]
     for aid, app in self.gApps.items():
         self.d.execute_script("document.querySelector('#app').value='%s'" %
                               aid)
         for c in channels:
             self.d.execute_script(
                 "document.querySelector('.mutl-select-trigger').value='%s'"
                 % c)
             self.d.find_element_by_id('query1').click()
             pic_name = '%s_%s_%s_%s.png' % (app, c, sd, ed)
             height = self.d.execute_script(
                 'return document.documentElement.offsetHeight')
             cut_res = cut_img(None, self.dir_path, pic_name)  # 截图保存
             if not cut_res['succ']:
                 logger.error('get img %s failed-------msg: %s' %
                              (pic_name, cut_res.get('msg')))
             logger.info('height: %s ---picname: %s' % (height, pic_name))
예제 #18
0
 def get_img(self, dates=None):
     """截图,并处理图片文件"""
     try:
         self.d.implicitly_wait(3)
         self.d.find_element_by_id('close-btn').click()
     except Exception:
         pass
     self.wait_element(By.CSS_SELECTOR, '.feed-report-tableArea .tr-data')
     try:
         for sd, ed in dates:
             self.d.refresh()
             self.wait_element(By.CSS_SELECTOR,
                               '.feed-report-tableArea .tr-data')
             # 更新日期
             self.set_date(sd, ed)
             time.sleep(1)
             # 等待数据表,无数据也会有tr-data
             self.wait_element(By.CSS_SELECTOR,
                               '.feed-report-tableArea .tr-data')
             # 截图
             pic_name = '%s_%s.png' % (sd, ed)
             height = self.d.execute_script(
                 r'return document.body.offsetHeight')
             cut_res = cut_img(height, self.dir_path, pic_name)
             if not cut_res['succ']:
                 logger.error(
                     'cut picture failed, possible msg:\ndir_path:%s\npic_name: %s'
                     % (self.dir_path, pic_name))
             logger.info('got a picture: pic_msg: %s' %
                         os.path.join(self.dir_path, pic_name))
             time.sleep(2)
         else:
             return {'succ': True, 'msg': 'img got success'}
     except Exception as e:
         logger.error(e, exc_info=1)
         return {'succ': False, 'msg': e}
예제 #19
0
 def get_img(self, sd, ed, data):
     pids = [
         x.get('key') for x in data.get('productList').get('data')
         if int(x.get('key')) > 0
     ]
     venders = [
         x.get('key') for x in data.get('vendorList').get('data')
         if int(x.get('key')) > 0
     ]
     sd, ed = sd.replace('-', ''), ed.replace('-', '')
     self.wait_element(By.ID,
                       'ifm1',
                       ec=EC.frame_to_be_available_and_switch_to_it)
     self.wait_element(By.CSS_SELECTOR, 'a.tabs-close').click()
     self.wait_element(By.ID, 'filetree_1_span').click()  # 点击数据统计
     self.wait_element(By.ID, 'filetree_3_span').click()  # 点击 CPA合作(含免费)
     time.sleep(1)
     self.d.switch_to.frame('ifm2')
     date_input = self.wait_element(By.ID,
                                    'reservation',
                                    ec=EC.presence_of_element_located)
     date_input.clear()
     date_input.send_keys("%s - %s" % (sd, ed))
     self.wait_element(By.CLASS_NAME, 'applyBtn').click()
     for item in data.get('channelList').get('data'):  # 循环所有渠道,截图
         if int(item.get('key')) < 0:
             logger.info('item key < 0, pass')
             continue
         res = self.has_data(sd, ed, pids, venders, item.get('key'))
         time.sleep(0.2)
         if not res:
             logger.info(
                 f'cut_img | data_range| {sd} ~ {ed} | {item.get("value")}')
             continue
         self.d.execute_script(
             'document.querySelector("#channelSelect").value="%s"' %
             (item.get('key')))
         self.d.execute_script(
             'document.querySelector(".searchbox div:nth-child(5) span:nth-child(2)").textContent="%s"'
             % (item.get('value')))
         self.d.execute_script(
             'document.querySelector("#feeSelect").value="1,0"')
         self.d.execute_script(
             'document.querySelector(".searchbox div:nth-child(6) span:nth-child(2)").textContent="是否付费(2条)"'
         )
         self.wait_element(By.XPATH,
                           '//*[@class="searchbox"]//div[5]//span[2]')
         time.sleep(1)
         self.wait_element(By.ID, 'searchBtn')
         self.wait_element(By.ID,
                           'searchBtn',
                           ec=EC.element_to_be_clickable).click()
         self.d.execute_script(
             'document.querySelector("#ui-multiselect-5-option-2").click()'
         )  # 设置显示条数
         # self.d.execute_script(
         #     "document.querySelector('.page_size_box button span:nth-child(2)').textContent='每页显示50行'"
         # )
         time.sleep(0.5)
         pgs = res // 50 if res > 50 else 1
         for p in range(pgs):
             pic_name = "%s_#%s_#%s_#page%s.png" % (item.get('value'), sd,
                                                    ed, p + 1)
             height = self.d.execute_script(
                 'return document.body.offsetHeight')
             cut_res = cut_img(height, self.dir_path, pic_name)
             if not cut_res['succ']:
                 logger.error(
                     'cut picture failed, possible msg:\ndir_path:%s\npic_name: %s'
                     % (self.dir_path, pic_name))
             logger.info('got a picture: pic_msg: %s' %
                         os.path.join(self.dir_path, pic_name))
             if pgs > 1:
                 self.wait_element(By.CLASS_NAME, 'pageDown').click()
             self.d.switch_to.default_content()
             self.d.execute_script("document.documentElement.scrollTop=0")
             self.d.switch_to.frame('ifm1')
             self.d.switch_to.frame('ifm2')
             time.sleep(0.3)
     else:
         self.d.switch_to.default_content()
예제 #20
0
 def getImg(self, sd, ed, data):
     """截图,并处理图片文件"""
     self.d.get('https://s.qq.com/tx/data/center.html')
     self.wait_element(By.CSS_SELECTOR, '#dataTable td')
     self.d.execute_script(
         'document.querySelector("#header_noticecontent").remove()')
     try:
         self.setDate(sd, ed)
         for channel in data.get('channelList'):
             ele = self.d.find_element_by_id('qudaoselect')
             qudao_slt = Select(ele)
             qudao_slt.deselect_all()
             qudao_slt.select_by_value(str(channel.get('id')))
             for game in data.get('gameList'):
                 self.d.execute_script(
                     "document.querySelector('#gameselect').value = '%s'" %
                     game.get('id'))
                 self.d.execute_script(
                     "document.querySelector('p.search span').textContent = '%s'"
                     % game.get('name'))
                 self.wait_element(By.CSS_SELECTOR, '#querybtn').click()
                 # searchbtn.click()
                 page = 1
                 while True:
                     self.d.execute_script(
                         'document.documentElement.scrollTop=0')
                     msg = self.wait_element(By.CSS_SELECTOR,
                                             '#dataTable td').text
                     if msg == '该条件下无数据':
                         break
                     pic_name = '%s_%s_%s_%s_p%s.png' % (
                         channel.get('id'), game.get('name'), sd, ed, page)
                     time.sleep(2)  # 等待数据完整之后再计算整个高度
                     height = self.d.execute_script(r'''
                         var stys = window.getComputedStyle(document.body);
                         var pt = parseFloat(stys.paddingTop.replace('px', ''));
                         var pb = parseFloat(stys.paddingBottom.replace('px', ''));
                         return document.body.offsetHeight + pt + pb
                     ''')
                     cut_res = cut_img(height, self.dir_path, pic_name)
                     if not cut_res['succ']:
                         logger.error(
                             'cut picture failed, possible msg:\ndir_path:%s\npic_name: %s'
                             % (self.dir_path, pic_name))
                     logger.info('got a picture: pic_msg: %s' %
                                 os.path.join(self.dir_path, pic_name))
                     # time.sleep(2)
                     try:
                         WebDriverWait(self.d, 1).until(
                             EC.presence_of_element_located(
                                 (By.CSS_SELECTOR,
                                  '#id_page .next'))).click()
                         page += 1
                         continue
                     except:
                         break
         return {'succ': True, 'msg': 'img got success'}
     except Exception as e:
         logger.error(e, exc_info=1)
         self.d.quit()
         return {'succ': False, 'msg': e}