From 82c4140fffe79c63634862dc91f2d1af53132639 Mon Sep 17 00:00:00 2001 From: g1879 Date: Fri, 3 Feb 2023 00:03:36 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A4=A7=E9=87=8F=E6=9B=B4=E6=96=B0=E6=96=87?= =?UTF-8?q?=E6=A1=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/{版本历史.md => 10_history.md} | 58 +- .../1_intimate_design.md} | 12 + .../2_features_demos/1_compare_with_requests.md} | 4 +- .../2_features_demos/2_compare_with_selenium.md} | 18 +- .../2_features_demos/3_switch_mode.md} | 6 +- .../2_features_demos/4_get_element_attributes.md} | 4 +- .../2_features_demos/5_download_file.md} | 0 .../1_installation_and_import.md} | 31 +- .../准备工作.md => 3_get_start/2_before_start.md} | 8 + .../3_examples/1_control_browser.md} | 4 + .../3_examples/2_data_packets.md} | 6 +- .../3_examples/3_switch_mode.md} | 6 +- .../4_basic_concept.md} | 34 +- docs/4_SessionPge/0_introduction.md | 46 + docs/4_SessionPge/1_create_page_object.md | 88 ++ docs/4_SessionPge/2_visit_web_page.md | 126 +++ docs/4_SessionPge/3_get_page_info.md | 181 ++++ docs/4_SessionPge/4_find_elements.md | 718 +++++++++++++++ docs/4_SessionPge/5_get_element_info.md | 306 +++++++ .../6_session_options.md} | 117 +-- docs/5_ChromiumPage/0_introduction.md | 44 + .../10_action_chains.md} | 78 +- .../11_browser_options.md} | 90 +- docs/5_ChromiumPage/1_create_page_object.md | 239 +++++ docs/5_ChromiumPage/2_visit_web_page.md | 62 ++ docs/5_ChromiumPage/3_get_page_info.md | 320 +++++++ docs/5_ChromiumPage/4_page_operation.md | 506 +++++++++++ docs/5_ChromiumPage/5_find_elements.md | 421 +++++++++ docs/5_ChromiumPage/6_get_element_info.md | 347 ++++++++ .../7_element_operation.md} | 278 ++++-- docs/5_ChromiumPage/8_tab_operation.md | 314 +++++++ .../9_frame_operation.md} | 167 +++- docs/6_WebPage/0_introduction.md | 15 + docs/6_WebPage/1_create_page_object.md | 103 +++ docs/6_WebPage/2_mode_switch.md | 97 ++ docs/6_WebPage/3_webpage_function.md | 57 ++ .../使用配置文件.md => 7_advance/1_ini_file.md} | 17 +- .../easy_set方法.md => 7_advance/2_easy_set.md} | 26 +- .../下载文件.md => 7_advance/3_download.md} | 56 +- docs/7_advance/4_accelerate_collecting.md | 109 +++ .../打包程序.md => 7_advance/5_packaging.md} | 4 + .../6_monitor_network.md} | 4 +- .../简介.md => 8_MixPage/0_introduction.md} | 0 .../10_work_with_selenium_and_requests.md} | 0 .../11_use_other_browser.md} | 0 .../12_DriverPage_and_SessionPage.md} | 14 +- .../1_create_page_object.md} | 0 .../访问网页.md => 8_MixPage/2_visit_web_page.md} | 4 +- .../3_find_page_element.md} | 0 .../4_get_element_info.md} | 14 +- .../5_element_operation.md} | 16 +- .../6_get_page_info.md} | 4 +- .../页面操作.md => 8_MixPage/7_page_operation.md} | 32 +- .../cookies的使用.md => 8_MixPage/8_cookies.md} | 0 .../Drission对象.md => 8_MixPage/9_Drission.md} | 0 .../douban_book_pics.md} | 6 + .../自动登录码云.md => 9_demos/login_gitee.md} | 6 + .../maoyan_TOP100.md} | 6 + .../multithreading_with_tabs.md} | 6 + .../starbucks_pics.md} | 6 + docs/README.md | 10 + docs/WebPage使用方法/3.1创建页面对象.md | 302 ------- docs/WebPage使用方法/3.2访问网页.md | 176 ---- docs/WebPage使用方法/3.3查找元素.md | 832 ------------------ docs/WebPage使用方法/3.4获取元素信息.md | 415 --------- docs/WebPage使用方法/3.6获取网页信息.md | 239 ----- docs/WebPage使用方法/3.7页面操作.md | 544 ------------ docs/WebPage使用方法/3.8标签页操作.md | 242 ----- docs/_sidebar.md | 143 +-- docs/scripts/theme-simple-dark.css | 2 +- docs/{鸣谢.md => thx.md} | 0 docs/启动配置/概述.md | 7 - docs/进阶使用/加速浏览器数据采集.md | 0 73 files changed, 4982 insertions(+), 3171 deletions(-) rename docs/{版本历史.md => 10_history.md} (89%) rename docs/{特性和亮点/贴心设计.md => 2_features/1_intimate_design.md} (99%) rename docs/{特性和亮点/特性演示/与requests代码对比.md => 2_features/2_features_demos/1_compare_with_requests.md} (95%) rename docs/{特性和亮点/特性演示/与selenium代码对比.md => 2_features/2_features_demos/2_compare_with_selenium.md} (82%) rename docs/{特性和亮点/特性演示/模式切换.md => 2_features/2_features_demos/3_switch_mode.md} (82%) rename docs/{特性和亮点/特性演示/获取并打印元素属性.md => 2_features/2_features_demos/4_get_element_attributes.md} (95%) rename docs/{特性和亮点/特性演示/下载文件.md => 2_features/2_features_demos/5_download_file.md} (100%) rename docs/{入门指南/安装和导入.md => 3_get_start/1_installation_and_import.md} (83%) rename docs/{入门指南/准备工作.md => 3_get_start/2_before_start.md} (98%) rename docs/{入门指南/上手示例/控制浏览器.md => 3_get_start/3_examples/1_control_browser.md} (99%) rename docs/{入门指南/上手示例/收发数据包.md => 3_get_start/3_examples/2_data_packets.md} (99%) rename docs/{入门指南/上手示例/模式切换.md => 3_get_start/3_examples/3_switch_mode.md} (99%) rename docs/{入门指南/基本概念.md => 3_get_start/4_basic_concept.md} (96%) create mode 100644 docs/4_SessionPge/0_introduction.md create mode 100644 docs/4_SessionPge/1_create_page_object.md create mode 100644 docs/4_SessionPge/2_visit_web_page.md create mode 100644 docs/4_SessionPge/3_get_page_info.md create mode 100644 docs/4_SessionPge/4_find_elements.md create mode 100644 docs/4_SessionPge/5_get_element_info.md rename docs/{启动配置/Session启动配置.md => 4_SessionPge/6_session_options.md} (87%) create mode 100644 docs/5_ChromiumPage/0_introduction.md rename docs/{WebPage使用方法/3.10动作链.md => 5_ChromiumPage/10_action_chains.md} (89%) rename docs/{启动配置/浏览器启动配置.md => 5_ChromiumPage/11_browser_options.md} (95%) create mode 100644 docs/5_ChromiumPage/1_create_page_object.md create mode 100644 docs/5_ChromiumPage/2_visit_web_page.md create mode 100644 docs/5_ChromiumPage/3_get_page_info.md create mode 100644 docs/5_ChromiumPage/4_page_operation.md create mode 100644 docs/5_ChromiumPage/5_find_elements.md create mode 100644 docs/5_ChromiumPage/6_get_element_info.md rename docs/{WebPage使用方法/3.5元素操作.md => 5_ChromiumPage/7_element_operation.md} (53%) create mode 100644 docs/5_ChromiumPage/8_tab_operation.md rename docs/{WebPage使用方法/3.9iframe操作.md => 5_ChromiumPage/9_frame_operation.md} (66%) create mode 100644 docs/6_WebPage/0_introduction.md create mode 100644 docs/6_WebPage/1_create_page_object.md create mode 100644 docs/6_WebPage/2_mode_switch.md create mode 100644 docs/6_WebPage/3_webpage_function.md rename docs/{启动配置/使用配置文件.md => 7_advance/1_ini_file.md} (87%) rename docs/{启动配置/easy_set方法.md => 7_advance/2_easy_set.md} (96%) rename docs/{WebPage使用方法/下载文件.md => 7_advance/3_download.md} (94%) create mode 100644 docs/7_advance/4_accelerate_collecting.md rename docs/{进阶使用/打包程序.md => 7_advance/5_packaging.md} (99%) rename docs/{进阶使用/监听浏览器网络.md => 7_advance/6_monitor_network.md} (92%) rename docs/{MixPage使用方法/简介.md => 8_MixPage/0_introduction.md} (100%) rename docs/{MixPage使用方法/对接selenium及requests代码.md => 8_MixPage/10_work_with_selenium_and_requests.md} (100%) rename docs/{MixPage使用方法/使用其它系统或浏览器.md => 8_MixPage/11_use_other_browser.md} (100%) rename docs/{MixPage使用方法/DriverPage和SessionPage.md => 8_MixPage/12_DriverPage_and_SessionPage.md} (90%) rename docs/{MixPage使用方法/创建页面对象.md => 8_MixPage/1_create_page_object.md} (100%) rename docs/{MixPage使用方法/访问网页.md => 8_MixPage/2_visit_web_page.md} (99%) rename docs/{MixPage使用方法/查找页面元素.md => 8_MixPage/3_find_page_element.md} (100%) rename docs/{MixPage使用方法/获取元素信息.md => 8_MixPage/4_get_element_info.md} (98%) rename docs/{MixPage使用方法/元素操作.md => 8_MixPage/5_element_operation.md} (96%) rename docs/{MixPage使用方法/获取网页信息.md => 8_MixPage/6_get_page_info.md} (99%) rename docs/{MixPage使用方法/页面操作.md => 8_MixPage/7_page_operation.md} (93%) rename docs/{MixPage使用方法/cookies的使用.md => 8_MixPage/8_cookies.md} (100%) rename docs/{MixPage使用方法/Drission对象.md => 8_MixPage/9_Drission.md} (100%) rename docs/{示例和技巧/下载豆瓣图书封面图片.md => 9_demos/douban_book_pics.md} (98%) rename docs/{示例和技巧/自动登录码云.md => 9_demos/login_gitee.md} (98%) rename docs/{示例和技巧/采集猫眼电影TOP100榜.md => 9_demos/maoyan_TOP100.md} (99%) rename docs/{示例和技巧/多线程操作多标签页.md => 9_demos/multithreading_with_tabs.md} (99%) rename docs/{示例和技巧/下载星巴克产品图片.md => 9_demos/starbucks_pics.md} (99%) delete mode 100644 docs/WebPage使用方法/3.1创建页面对象.md delete mode 100644 docs/WebPage使用方法/3.2访问网页.md delete mode 100644 docs/WebPage使用方法/3.3查找元素.md delete mode 100644 docs/WebPage使用方法/3.4获取元素信息.md delete mode 100644 docs/WebPage使用方法/3.6获取网页信息.md delete mode 100644 docs/WebPage使用方法/3.7页面操作.md delete mode 100644 docs/WebPage使用方法/3.8标签页操作.md rename docs/{鸣谢.md => thx.md} (100%) delete mode 100644 docs/启动配置/概述.md delete mode 100644 docs/进阶使用/加速浏览器数据采集.md diff --git a/docs/版本历史.md b/docs/10_history.md similarity index 89% rename from docs/版本历史.md rename to docs/10_history.md index 1a221ea..b6bfdf4 100644 --- a/docs/版本历史.md +++ b/docs/10_history.md @@ -1,50 +1,60 @@ +# v3.1.3 + +- `ChromiumPage`添加`latest_tab`属性 + +- `WebPage`初始化删除`tab_id`参数 + +- 修复页面未加载完可能获取到空元素的问题 + +- 修复新标签页重定向时获取文档不正确问题 + +- 增强稳定性 + # v3.1.1 - 增强下载功能 - - `ChromiumPage`也可以使用内置下载器下载文件 + - `ChromiumPage`也可以使用内置下载器下载文件 - - 可拦截并接管浏览器下载任务 + - 可拦截并接管浏览器下载任务 - - 新增`download_set`属性对下载参数进行设置 + - 新增`download_set`属性对下载参数进行设置 - - 增加`wait_download_begin()`方法 - - - 重构部分代码 + - 增加`wait_download_begin()`方法 - 改进浏览器启动设置 - - 优化 ini 文件结构 + - 优化 ini 文件结构 - - 新增`ChromiumOptions`取代`DriverOptions`,完全摆脱对 selenium 的依赖 + - 新增`ChromiumOptions`取代`DriverOptions`,完全摆脱对 selenium 的依赖 - - 新增自动分配端口功能 + - 新增自动分配端口功能 - - 优化`SessionOptions`设计,增加一系列设置参数的方法 + - 优化`SessionOptions`设计,增加一系列设置参数的方法 - - 改进对用户配置文件的设置 + - 改进对用户配置文件的设置 - 对部分代码进行重构 - - 优化页面对象启动逻辑 + - 优化页面对象启动逻辑 - - 优化配置类逻辑 + - 优化配置类逻辑 - - 优化项目结构 + - 优化项目结构 - 细节 - - 上传文件时支持传入相对路径 + - 上传文件时支持传入相对路径 - bug 修复 - - 修复`get_tab()`出错问题 + - 修复`get_tab()`出错问题 - - 修复新浏览器第一次新建标签页时不正确切换的问题 + - 修复新浏览器第一次新建标签页时不正确切换的问题 - - 修复关闭当前标签页出错问题 + - 修复关闭当前标签页出错问题 - - 修复改变浏览器窗口大小出错问题 + - 修复改变浏览器窗口大小出错问题 # v3.0.34 @@ -129,8 +139,8 @@ # v2.7.1 - DriverPage - - 增加`get_session_storage()`、`get_local_storage()`、`set_session_storage()`、`set_local_storage()`、`clean_cache()`方法 - - `run_cdp()`的`cmd_args`参数改为`**cmd_args` + - 增加`get_session_storage()`、`get_local_storage()`、`set_session_storage()`、`set_local_storage()`、`clean_cache()`方法 + - `run_cdp()`的`cmd_args`参数改为`**cmd_args` - 关闭 driver 时会主动关闭 chromedriver.exe 的进程 - 优化关闭浏览器进程逻辑 @@ -142,9 +152,9 @@ # v2.6.0 - 新增`Listener`类 - - 可监听浏览器数据包 - - 可异步监听 - - 可实现每监听到若干数据包执行操作 + - 可监听浏览器数据包 + - 可异步监听 + - 可实现每监听到若干数据包执行操作 - 放弃对selenium4.1以下的支持 - 解决使用新版浏览器时出现的一些问题 diff --git a/docs/特性和亮点/贴心设计.md b/docs/2_features/1_intimate_design.md similarity index 99% rename from docs/特性和亮点/贴心设计.md rename to docs/2_features/1_intimate_design.md index f18f632..81cb98f 100644 --- a/docs/特性和亮点/贴心设计.md +++ b/docs/2_features/1_intimate_design.md @@ -16,6 +16,8 @@ - 设置页面加载时限及加载策略。有时不需要完整加载页面资源,可根据实际须要设置加载策略。 +--- + # ✔️ 自动重试连接 在访问网站时,由于网络不稳定可能导致连接异常。本库设置了连接自动重试功能,当网页连接异常,会默认重试 3 次。当然也可以手动设置次数和间隔。 @@ -24,6 +26,8 @@ page.get('xxxxxx', retry=5, interval=3) # 出错是重试 5 次,每次间隔 3 秒 ``` +--- + # ✔️ 极简的定位语法 本库制定了一套简洁高效的查找元素语法,支持链式操作,支持相对定位。与 selenium 繁琐的语法相比简直不要太方便。 @@ -40,6 +44,8 @@ element = WebDriverWait(driver, 10).until(ec.presence_of_element_located((By.XPA element = page('some text', timeout=10) ``` +--- + # ✔️ 无需切入切出,逻辑清晰 使用过 selenium 的人都知道,selenium 同一时间只能操作一个标签页或`