Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
yma16
auto_python
提交
aa1e04bd
A
auto_python
项目概览
yma16
/
auto_python
与 Fork 源项目一致
Fork自
inscode / Python
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
A
auto_python
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
aa1e04bd
编写于
4月 01, 2025
作者:
Q
qq_38870145
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Tue Apr 1 19:58:00 CST 2025 inscode
上级
04e2a310
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
9 addition
and
32 deletion
+9
-32
outlook.py
outlook.py
+9
-32
未找到文件。
outlook.py
浏览文件 @
aa1e04bd
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<window height
if
end_rect_top
<
window_height
:
break
i
+=
1
# 加渲染高度 翻页 好拼接
lastScrollTop
+=
clientHeight
...
...
@@ -92,33 +90,12 @@ def screen_shot(driver):
driver
.
save_screenshot
(
img_path
)
cut_img
(
img_path
,
element
,
dir
,
i
)
full_img_paths
.
append
(
img_path
)
end_rect_bottom
=
driver
.
execute_script
(
'return document.querySelector(".T_6Xj").getBoundingClientRect().bottom;'
)
end_rect_top
=
driver
.
execute_script
(
'return document.querySelector(".T_6Xj").getBoundingClientRect().top;'
)
# end
if
end_rect_top
<
window_height
and
end_rect_bottom
>
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<cut_len:
# gen_img_path = f'{dir}/temp_result_{i}.png'
# if first ==0:
# img1_path=cut_img_paths[first]
# else:
# img1_path= gen_img_path
# join_images(img1_path,cut_img_paths[second],0,gen_img_path)
# second += 1
# print('second',second)
# 裁剪顶部高度 渲染高度
crop_height
=
driver
.
execute_script
(
'return document.getElementById("ConversationReadingPaneContainer").firstChild.offsetHeight;'
)
# 8px padding
...
...
@@ -248,7 +225,7 @@ def mapMSg():
break
time
.
sleep
(
1
)
driver
.
quit
()
time
.
sleep
(
50
)
time
.
sleep
(
3
)
driver
.
close
()
if
__name__
==
'__main__'
:
run
()
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录