diff --git a/outlook.py b/outlook.py index 42a2decb203e9784e6ac3e469ec8b4181b1244c8..ae983000a0b34be95219f96d66fb294663f3f8e8 100644 --- a/outlook.py +++ b/outlook.py @@ -1,8 +1,5 @@ import time,math from selenium import webdriver -from selenium.webdriver.common.by import By -from selenium.webdriver.chrome.service import Service - from selenium.webdriver.common.by import By from selenium.webdriver.support.ui import WebDriverWait from selenium.webdriver.support import expected_conditions as EC @@ -44,11 +41,6 @@ def cut_img(screenshot_path,element,baseDir,loc): def screen_shot(driver): dir=gen_dir() - # global cut_img_paths - # cut_img_paths=[] - # global full_img_paths - # full_img_paths=[] - # 当前滚动高度 scrollTop=driver.execute_script( 'return document.getElementById("ConversationReadingPaneContainer").childNodes[1].childNodes[0].scrollTop;') @@ -81,6 +73,12 @@ def screen_shot(driver): full_img_paths.append(img_path) # 滚动底部 + 渲染高度 翻页滚动 while math.ceil(lastScrollTop+1) < scrollHeight: + end_rect_top = driver.execute_script('return document.querySelector(".g4Y3U").getBoundingClientRect().top;') + sleep(.5) + # end 结束 节点出现在可视区域 dom rect top 0: - break + + else: # 完整email img_path=f'{dir}/full_screen_email.png' driver.save_screenshot(img_path) - - cut_len=len(cut_img_paths) - first=0 - second=1 - - - print('cut_img_paths',cut_img_paths) - print('cut_len',cut_len) - # while second