pub struct ChromiumTab { /* private fields */ }cdp only.Expand description
一个 Chromium 标签页(或附着的 Electron 窗口)。克隆共享同一底层标签。
Implementations§
Source§impl ChromiumTab
impl ChromiumTab
Sourcepub async fn ax_tree(&self) -> Result<AxTree>
pub async fn ax_tree(&self) -> Result<AxTree>
CDP 原生无障碍树(Accessibility.getFullAXTree):角色/可见名来自 Chrome 无障碍引擎,最准确。
用于抗改版断言(按角色+名定位)或喂 LLM(语义树比整页 HTML 小一个数量级)。
Sourcepub async fn ax_snapshot(&self) -> Result<AxTree>
pub async fn ax_snapshot(&self) -> Result<AxTree>
DOM 派生的近似无障碍快照(注入 AX_SNAPSHOT_JS 按 ARIA 规则算):跨后端一致、
无需 Accessibility 域。准确度略低于 ax_tree,但任何 run_js 能跑处都可用。
Source§impl ChromiumTab
impl ChromiumTab
Sourcepub async fn pass_cloudflare_default(&self) -> Result<bool>
pub async fn pass_cloudflare_default(&self) -> Result<bool>
自动通过 Cloudflare 挑战(默认 30s 超时)。见 pass_cloudflare。
Sourcepub async fn pass_cloudflare(&self, timeout: Duration) -> Result<bool>
pub async fn pass_cloudflare(&self, timeout: Duration) -> Result<bool>
在 timeout 内尝试通过 Cloudflare 挑战(整页托管质询 或 表单内嵌 Turnstile):
- 已出有效 Turnstile token / 已不是挑战页 → 立即返回
true; - 发现 Turnstile 复选框(含闭合 shadow DOM 里的,经 respbox 定位)→ 拟人移动 + 可信点击,等待放行;
- 只有非交互式挑战(无复选框)→ 轮询等待其自动放行。
返回是否在超时内通过。非破坏:不是挑战页时等价一次轻量探测后立即返回。
内嵌 Turnstile 过盾后 widget 仍留在 DOM,故以 cf-turnstile-response 是否产出 token 为过盾判据
(不能等“挑战消失“)。
Sourcepub async fn is_cloudflare(&self) -> Result<bool>
pub async fn is_cloudflare(&self) -> Result<bool>
当前是否处于 Cloudflare 挑战页(轻量探测,不点击)。
Source§impl ChromiumTab
impl ChromiumTab
Sourcepub async fn print_to_pdf(&self, opts: &PdfOptions) -> Result<Vec<u8>>
pub async fn print_to_pdf(&self, opts: &PdfOptions) -> Result<Vec<u8>>
把当前页打印为 PDF 字节(Page.printToPDF,对标 Playwright/Puppeteer page.pdf())。
需无头 Chrome(有头模式 Chrome 不一定返回数据)。
Sourcepub async fn save_pdf(
&self,
path: impl AsRef<Path>,
opts: &PdfOptions,
) -> Result<PathBuf>
pub async fn save_pdf( &self, path: impl AsRef<Path>, opts: &PdfOptions, ) -> Result<PathBuf>
把当前页打印为 PDF 并保存到 path(自动创建父目录)。返回最终路径。
Sourcepub async fn set_content(&self, html: &str) -> Result<()>
pub async fn set_content(&self, html: &str) -> Result<()>
直接把页面文档内容设为 html(对标 Playwright/Puppeteer page.set_content)。
优先 Page.setDocumentContent,失败回退 document.open/write/close。
Sourcepub async fn mhtml(&self) -> Result<String>
pub async fn mhtml(&self) -> Result<String>
抓取当前页的 MHTML 单文件快照字符串(Page.captureSnapshot,对标 DP tab.save())。
Sourcepub async fn save_mhtml(&self, path: impl AsRef<Path>) -> Result<PathBuf>
pub async fn save_mhtml(&self, path: impl AsRef<Path>) -> Result<PathBuf>
抓取 MHTML 并保存到 path(.mhtml)。返回最终路径。
Sourcepub async fn expose_function<F>(
&self,
name: &str,
handler: F,
) -> Result<ExposedFunction>
pub async fn expose_function<F>( &self, name: &str, handler: F, ) -> Result<ExposedFunction>
把一个 Rust 闭包暴露成页面里的全局异步函数 window.<name>(...args)(对标
Playwright/Puppeteer expose_function)。页面 await window.name(a,b) 会回调 handler,
其返回值(JSON)作为 Promise 结果回传页面。
反检测取舍:为收到 Runtime.bindingCalled 事件需开 Runtime.enable(同 console()),
故对极致反检测场景慎用。返回的 ExposedFunction 守卫 drop 即停止回调。
Sourcepub async fn har_record(&self) -> Result<HarRecorder>
pub async fn har_record(&self) -> Result<HarRecorder>
开始录制 HAR(HTTP Archive,含响应体)。在导航前调用;stop() 拿 HarLog 落盘。
对标 Playwright record_har。
Sourcepub async fn har_record_with(&self, capture_bodies: bool) -> Result<HarRecorder>
pub async fn har_record_with(&self, capture_bodies: bool) -> Result<HarRecorder>
同 har_record,capture_bodies=false 则不抓响应体(更省、更快)。
Source§impl ChromiumTab
impl ChromiumTab
Sourcepub async fn route_from_har(
&self,
path: impl AsRef<Path>,
opts: &HarReplayOptions,
) -> Result<HarPlayer>
pub async fn route_from_har( &self, path: impl AsRef<Path>, opts: &HarReplayOptions, ) -> Result<HarPlayer>
用一个 .har 文件回放网络:命中的请求直接用 HAR 里录的响应满足,不走真实网络
(对标 Playwright route_from_har)。在导航前调用。返回 HarPlayer 守卫。
Sourcepub async fn route_from_har_log(
&self,
log: &HarLog,
opts: &HarReplayOptions,
) -> Result<HarPlayer>
pub async fn route_from_har_log( &self, log: &HarLog, opts: &HarReplayOptions, ) -> Result<HarPlayer>
用内存里的 HarLog(如刚 har_record().stop() 拿到的)回放网络。
Source§impl ChromiumTab
impl ChromiumTab
Sourcepub async fn attach_oopifs(&self, settle: Duration) -> Result<Vec<ChildTarget>>
pub async fn attach_oopifs(&self, settle: Duration) -> Result<Vec<ChildTarget>>
开启对子 target(OOPIF 跨域 iframe / 专用 worker)的自动附着,收集 settle 时间窗内
已附着的全部子 target;每个都带一个可独立逆向的 ChromiumTab。
站点隔离下,跨域 iframe(如 Cloudflare Turnstile)跑在独立进程、主 target 进不去;本方法用
Target.setAutoAttach{flatten:true} 拿到它们的独立 sessionId,从而能在 iframe 内部
scripts()(dump challenge 脚本)/ debugger()(下断点)/ hook()(偷 key)/ listen()(抓包)。
语义:先订阅事件再开启 auto-attach —— 开启那一刻会对当前已存在的子 target 补发
attachedToTarget,故能拿到调用时刻已存在的子 target;settle 是等这些事件汇齐的静默窗
(典型 1–2s)。调用时机:应在「目标 iframe 已出现」之后(如触发 Turnstile、页面渲染完)再调。
嵌套 OOPIF 直接对返回项的 child.tab().attach_oopifs(..) 继续下钻即可。
Sourcepub async fn wait_oopif(
&self,
url_substr: &str,
timeout_dur: Option<Duration>,
) -> Result<Option<ChildTarget>>
pub async fn wait_oopif( &self, url_substr: &str, timeout_dur: Option<Duration>, ) -> Result<Option<ChildTarget>>
等待一个 URL 含 url_substr 的子 target 被附着(如等 Turnstile 的
challenges.cloudflare.com iframe 出现),返回其可逆向 tab。超时返回 None。
会先开启 auto-attach;timeout_dur 为 None 时用本标签默认超时。
Source§impl ChromiumTab
impl ChromiumTab
Sourcepub fn recorder(&self) -> ChromiumRecorder
pub fn recorder(&self) -> ChromiumRecorder
录制器句柄(对标 Playwright codegen):录一遍页面操作 → 生成可运行 Rust 代码。
let rec = tab.recorder();
rec.start().await?; // 导航前起录
tab.get("https://example.com").await?;
// ... 人工(或程序)操作页面 ...
let script = rec.stop().await?;
println!("{}", script.to_rust()); // 可运行 Rust(DP 风格选择器)Source§impl ChromiumTab
impl ChromiumTab
Sourcepub async fn slider_gap(&self, cfg: &SliderConfig) -> Result<SliderGap>
Available on crate feature slider only.
pub async fn slider_gap(&self, cfg: &SliderConfig) -> Result<SliderGap>
slider only.纯视觉:按 SliderConfig 读图、自动选缺口算法,算出拼图需要水平移动的距离(SliderGap)。
要求验证图已显示。读图失败 / 无有效结果返回 Err。
Sourcepub async fn solve_slider(&self, cfg: &SliderConfig) -> Result<SliderResult>
Available on crate feature slider only.
pub async fn solve_slider(&self, cfg: &SliderConfig) -> Result<SliderResult>
slider only.一把梭:弹出→匹配→闭环拟人拖动→判定→非通过换图重试。返回 SliderResult。
Sourcepub async fn geetest_slide_gap(&self) -> Result<SliderGap>
Available on crate feature slider only.
pub async fn geetest_slide_gap(&self) -> Result<SliderGap>
slider only.极验 v4 滑块缺口(预设 SliderConfig::geetest_v4 的 slider_gap)。
Sourcepub async fn solve_geetest_slide(&self) -> Result<SliderResult>
Available on crate feature slider only.
pub async fn solve_geetest_slide(&self) -> Result<SliderResult>
slider only.一把梭求解极验 v4 滑块(预设 SliderConfig::geetest_v4 的 solve_slider)。
要调尝试次数等用 solve_slider(&SliderConfig::geetest_v4().max_attempts(8))。
Sourcepub async fn dingxiang_slide_gap(&self, index: u32) -> Result<SliderGap>
Available on crate feature slider only.
pub async fn dingxiang_slide_gap(&self, index: u32) -> Result<SliderGap>
slider only.顶象滑块缺口(预设 SliderConfig::dingxiang 的 slider_gap,index=实例后缀)。
Sourcepub async fn solve_dingxiang_slide(
&self,
index: u32,
open: Option<&str>,
) -> Result<SliderResult>
Available on crate feature slider only.
pub async fn solve_dingxiang_slide( &self, index: u32, open: Option<&str>, ) -> Result<SliderResult>
slider only.一把梭求解顶象滑块(预设 SliderConfig::dingxiang)。弹出式传 open 触发按钮(如 #btn-popup)。
注:顶象 demo 对自动化拖动有轨迹/IP 行为风控会弹回(与缺口算法无关);本方法只保证缺口找得准 +
拖到位。要自定义尝试次数等改用 solve_slider(&SliderConfig::dingxiang(i)...)。
Source§impl ChromiumTab
impl ChromiumTab
Sourcepub async fn storage_state(&self) -> Result<StorageState>
pub async fn storage_state(&self) -> Result<StorageState>
导出当前登录态:全部 cookie + 当前源的 localStorage / sessionStorage。
对齐 camoufox Tab::storage_state。
Sourcepub async fn save_storage_state(&self, path: &str) -> Result<()>
pub async fn save_storage_state(&self, path: &str) -> Result<()>
导出并存盘(JSON)。对齐 camoufox Tab::save_storage_state。
Sourcepub async fn load_storage_state(&self, path: &str) -> Result<()>
pub async fn load_storage_state(&self, path: &str) -> Result<()>
从磁盘读回并应用(cookie 全量;storage 仅应用与当前源匹配的那组)。
对齐 camoufox Tab::load_storage_state。
Sourcepub async fn apply_storage_state(&self, state: &StorageState) -> Result<()>
pub async fn apply_storage_state(&self, state: &StorageState) -> Result<()>
应用一个 StorageState:cookie 全量;localStorage / sessionStorage 仅应用与当前源匹配的那组。
对齐 camoufox Tab::apply_storage_state。
Source§impl ChromiumTab
impl ChromiumTab
Sourcepub fn set_timeout(&self, d: Duration)
pub fn set_timeout(&self, d: Duration)
设置默认超时(影响 ele 等待 / 监听 / 拦截)。
Sourcepub fn dump_env(&self) -> ChromiumEnvDumper
pub fn dump_env(&self) -> ChromiumEnvDumper
通用吐环境入口(对齐 camoufox Tab::dump_env):链式指定目标参数(query/header/cookie)与范围后
start() 注入探针。详见 crate::envkit。
let mut probe = tab.dump_env().target_query("a_bogus")
.match_url("aweme/v1/web/aweme/detail").start().await?;
tab.get(url).await?;
let dump = probe.collect().await?;
dump.write_to("./dump-env")?;Sourcepub async fn close(&self) -> Result<()>
pub async fn close(&self) -> Result<()>
关闭本标签(Target.closeTarget);若是 new_tab_with 带代理建的独立 BrowserContext,
一并销毁该上下文(对齐 camoufox Tab::close,池任务结束回收用)。
Sourcepub async fn get(&self, url: &str) -> Result<bool>
pub async fn get(&self, url: &str) -> Result<bool>
导航到 url 并等待 load 事件(最多默认超时)。返回是否在超时内加载完成
(对齐 camoufox Tab::get 的 Result<bool>;超时返回 false,不报错)。
Sourcepub async fn get_with(&self, url: &str, opts: &GetOptions) -> Result<bool>
pub async fn get_with(&self, url: &str, opts: &GetOptions) -> Result<bool>
带选项导航(retry/interval/timeout/load_mode/referer),对齐 camoufox Tab::get_with。
Sourcepub async fn stop_loading(&self) -> Result<()>
pub async fn stop_loading(&self) -> Result<()>
停止加载(对齐 camoufox Tab::stop_loading)。
Sourcepub async fn ready_state(&self) -> Result<String>
pub async fn ready_state(&self) -> Result<String>
当前 document.readyState(loading/interactive/complete)。
Sourcepub async fn wait_loaded(&self) -> Result<bool>
pub async fn wait_loaded(&self) -> Result<bool>
在默认超时内等待 document.readyState === 'complete';返回是否就绪(超时 false,不报错)。
Sourcepub fn url_available(&self) -> bool
pub fn url_available(&self) -> bool
最近一次 get 是否加载成功(同步读,对齐 camoufox Tab::url_available)。
Sourcepub async fn user_agent(&self) -> Result<String>
pub async fn user_agent(&self) -> Result<String>
页面 User-Agent(navigator.userAgent)。
Sourcepub async fn handle_next_dialog(
&self,
accept: bool,
prompt_text: Option<&str>,
) -> Result<DialogInfo>
pub async fn handle_next_dialog( &self, accept: bool, prompt_text: Option<&str>, ) -> Result<DialogInfo>
接管下一个 JS 对话框(alert/confirm/prompt),accept 是否确认、prompt_text 为 prompt 输入。
对话框会阻塞页面 JS,必须与触发动作并发(tokio::join! 触发 + 本方法)。对齐 camoufox。
Sourcepub async fn set_download_path(&self, dir: impl AsRef<Path>) -> Result<()>
pub async fn set_download_path(&self, dir: impl AsRef<Path>) -> Result<()>
设下载目录并允许下载(Browser.setDownloadBehavior,对齐 camoufox 下载落盘)。
同时记录到内核,使后续 downloads() 的 start() 可直接读取。
Sourcepub fn downloads(&self) -> ChromiumDownloads
pub fn downloads(&self) -> ChromiumDownloads
下载管理句柄(对标 DP tab.downloads / 对齐 camoufox Tab::downloads):多任务并发跟踪 +
任务列表 + 进度 + 重命名。基于 CDP 原生下载事件。需先设下载目录
(ChromiumOptions::download_path 或 set_download_path)。
Sourcepub async fn wait_download(&self, timeout: Duration) -> Result<DownloadInfo>
pub async fn wait_download(&self, timeout: Duration) -> Result<DownloadInfo>
等待一次下载开始并完成(需先 set_download_path),返回信息。
必须与触发下载的动作并发。对齐 camoufox Tab::wait_download。
Sourcepub async fn run_js(&self, expression: &str) -> Result<Value>
pub async fn run_js(&self, expression: &str) -> Result<Value>
在页面执行 JS 表达式,返回结果值(Runtime.evaluate,自动 await Promise)。
Sourcepub async fn ele(&self, selector: &str) -> Result<ChromiumElement>
pub async fn ele(&self, selector: &str) -> Result<ChromiumElement>
查找第一个匹配元素(DP 定位语法);未找到立即返回 Error::ElementNotFound。
Sourcepub async fn wait_ele(
&self,
selector: &str,
timeout: Option<Duration>,
) -> Result<ChromiumElement>
pub async fn wait_ele( &self, selector: &str, timeout: Option<Duration>, ) -> Result<ChromiumElement>
查找第一个匹配元素,在默认超时内轮询等待它出现;超时返回 Error::ElementNotFound。
Sourcepub async fn ele_text(&self, selector: &str) -> Result<Option<String>>
pub async fn ele_text(&self, selector: &str) -> Result<Option<String>>
元素可见文本(CSS/xpath 定位);未找到返回 None。便捷封装。
Sourcepub async fn s_root(&self) -> Result<StaticElement>
pub async fn s_root(&self) -> Result<StaticElement>
解析当前页面 HTML 为静态根元素(对齐 camoufox Tab::s_root)。
Sourcepub async fn s_ele(&self, selector: &str) -> Result<StaticElement>
pub async fn s_ele(&self, selector: &str) -> Result<StaticElement>
静态查找第一个匹配元素(离线解析,极快;对齐 camoufox Tab::s_ele)。
Sourcepub async fn s_eles(&self, selector: &str) -> Result<Vec<StaticElement>>
pub async fn s_eles(&self, selector: &str) -> Result<Vec<StaticElement>>
静态查找所有匹配元素(对齐 camoufox Tab::s_eles)。
Sourcepub async fn get_frame(&self, selector: &str) -> Result<ChromiumFrame>
pub async fn get_frame(&self, selector: &str) -> Result<ChromiumFrame>
取 selector 命中的 <iframe> 的内容帧用于帧内查找(对齐 camoufox Tab::get_frame)。
Sourcepub async fn exists(&self, selector: &str) -> Result<bool>
pub async fn exists(&self, selector: &str) -> Result<bool>
元素是否存在(轻量:只查一次、不等待)。对标 Camoufox 后端 Tab::exists。
Sourcepub async fn click(&self, selector: &str) -> Result<()>
pub async fn click(&self, selector: &str) -> Result<()>
可信点击定位到的元素(底层走元素句柄的原生点击)。未找到返回
Error::ElementNotFound(对齐 camoufox Tab::click 的 Result<()>)。
Sourcepub async fn input(&self, selector: &str, text: &str) -> Result<()>
pub async fn input(&self, selector: &str, text: &str) -> Result<()>
给输入框填值(一次性插入)。未找到返回 Error::ElementNotFound
(对齐 camoufox Tab::input 的 Result<()>)。
Sourcepub async fn mouse_drag(&self, x: f64, y: f64) -> Result<()>
pub async fn mouse_drag(&self, x: f64, y: f64) -> Result<()>
按住左键移动到 (x, y)(拖拽中的 move,buttons=1)。
Sourcepub fn mouse_move_fast(&self, x: f64, y: f64) -> Result<()>
pub fn mouse_move_fast(&self, x: f64, y: f64) -> Result<()>
不等往返移动鼠标(拟人密集采样用,节奏交给调用方 sleep)。对齐 camoufox mouse_move_fast。
Sourcepub fn mouse_drag_fast(&self, x: f64, y: f64) -> Result<()>
pub fn mouse_drag_fast(&self, x: f64, y: f64) -> Result<()>
不等往返按住左键移动(拖拽密集采样)。对齐 camoufox mouse_drag_fast。
Sourcepub async fn wheel_at(
&self,
x: f64,
y: f64,
delta_x: f64,
delta_y: f64,
) -> Result<()>
pub async fn wheel_at( &self, x: f64, y: f64, delta_x: f64, delta_y: f64, ) -> Result<()>
在视口坐标 (x, y) 派发滚轮事件(可信 mouseWheel)。对齐 camoufox wheel_at。
Sourcepub async fn wheel(&self, delta_x: f64, delta_y: f64) -> Result<()>
pub async fn wheel(&self, delta_x: f64, delta_y: f64) -> Result<()>
在视口一个固定可见点派发滚轮事件(wheel_at 的便捷版)。对齐 camoufox wheel。
Sourcepub async fn scroll_by(&self, x: f64, y: f64) -> Result<()>
pub async fn scroll_by(&self, x: f64, y: f64) -> Result<()>
直接滚动文档 window.scrollBy(x, y)(对齐 camoufox scroll_by)。
Sourcepub async fn key_combo(&self, keys: &[&str]) -> Result<()>
pub async fn key_combo(&self, keys: &[&str]) -> Result<()>
修饰组合键 / 热键:最后一项为主键,其余为修饰键(Control/Ctrl、Shift、Alt、
Meta/Cmd)。CDP 原生 modifiers 位掩码,页面读得到 e.ctrlKey/metaKey 等为 true。
作用于当前焦点(先 ele.click()/focus() 选中目标);元素级用 ChromiumElement::shortcut。
use drission::prelude::*;
tab.key_combo(&[Keys::CONTROL, "a"]).await?; // 全选
tab.key_combo(&[Keys::CONTROL, Keys::SHIFT, "z"]).await?; // 重做Sourcepub async fn type_keys(&self, parts: &[KeyInput]) -> Result<()>
pub async fn type_keys(&self, parts: &[KeyInput]) -> Result<()>
按序列输入(文本片段直接插入、特殊键派发按键)。需先聚焦目标(如先 ele.click())。
Sourcepub async fn screenshot_bytes(&self) -> Result<Vec<u8>>
pub async fn screenshot_bytes(&self) -> Result<Vec<u8>>
可视区截图(PNG 字节)。
Sourcepub async fn screenshot_full_bytes(&self) -> Result<Vec<u8>>
pub async fn screenshot_full_bytes(&self) -> Result<Vec<u8>>
整页截图(PNG 字节,captureBeyondViewport)。
Sourcepub async fn get_screenshot(
&self,
path: impl AsRef<Path>,
full_page: bool,
) -> Result<PathBuf>
pub async fn get_screenshot( &self, path: impl AsRef<Path>, full_page: bool, ) -> Result<PathBuf>
截图存盘(full_page=true 整页);自动建父目录。对标 Camoufox 后端 Tab::get_screenshot。
Sourcepub async fn screenshot(&self, opts: &ShotOpts) -> Result<Vec<u8>>
pub async fn screenshot(&self, opts: &ShotOpts) -> Result<Vec<u8>>
全能力截图(区域 / 整页 / 格式 / 质量)。对齐 camoufox Tab::screenshot(&ShotOpts)。
Sourcepub async fn screenshot_base64(&self, full_page: bool) -> Result<String>
pub async fn screenshot_base64(&self, full_page: bool) -> Result<String>
截图返回 base64 字符串(full_page 整页)。对齐 camoufox Tab::screenshot_base64。
Sourcepub async fn size(&self) -> Result<(f64, f64)>
pub async fn size(&self) -> Result<(f64, f64)>
可视视口尺寸 (innerWidth, innerHeight)。对齐 camoufox Tab::size。
Sourcepub async fn page_size(&self) -> Result<(f64, f64)>
pub async fn page_size(&self) -> Result<(f64, f64)>
整页内容尺寸 (scrollWidth, scrollHeight)。对齐 camoufox Tab::page_size。
取全部 cookie(原始 CDP Storage.getCookies 结果,含 httpOnly)。
每项含 name/value/domain/path/expires/httpOnly/secure 等字段。
用于把登录态交接给 SessionPage(纯 HTTP 接力)或存盘复用。
取全部 cookie 为类型化 Cookie(对齐 camoufox Tab::cookies)。
批量设置 cookie(对齐 camoufox Tab::set_cookies)。每项至少 name/value + url 或 domain。
Sourcepub async fn ocr_image(&self, selector: &str) -> Result<String>
Available on crate feature ocr only.
pub async fn ocr_image(&self, selector: &str) -> Result<String>
ocr only.识别图片验证码:<img> 的 data:URL 直接解码、否则元素截图,再走 OCR。需 --features ocr。
对齐 camoufox Tab::ocr_image:识别走共享识别器 crate::ocr::set_default_ocr 的热替换槽
优先、否则懒加载默认 ddddocr,故自训模型对本方法即时生效。
Sourcepub async fn ocr_calc(&self, selector: &str) -> Result<String>
Available on crate feature ocr only.
pub async fn ocr_calc(&self, selector: &str) -> Result<String>
ocr only.一步解计算题验证码:取图(同 ocr_image)→ 识别算术式 → 求值 → 答案字符串
(如 "8")。对齐 camoufox Tab::ocr_calc;识别不出算术式则报错。需 --features ocr。
Sourcepub fn actions(&self) -> ChromiumActions
pub fn actions(&self) -> ChromiumActions
动作链句柄(对标 DP tab.actions):链式串鼠标/键盘动作,perform().await 执行。
Sourcepub fn scroll(&self) -> ChromiumScroll
pub fn scroll(&self) -> ChromiumScroll
滚动句柄(对标 DP tab.scroll):to_top/to_bottom/by/to_location/to_see。
Sourcepub fn set(&self) -> ChromiumSetTab
pub fn set(&self) -> ChromiumSetTab
设置句柄(对标 DP tab.set):timeout/user_agent/cookies/window()。
Sourcepub fn wait(&self) -> ChromiumWait
pub fn wait(&self) -> ChromiumWait
等待句柄(对标 DP tab.wait):doc_loaded/ele_displayed/ele_deleted/title_contains/url_contains。
Sourcepub async fn paginate<F, Fut, T>(
&self,
next_selector: &str,
max_pages: usize,
f: F,
) -> Result<Vec<T>>
pub async fn paginate<F, Fut, T>( &self, next_selector: &str, max_pages: usize, f: F, ) -> Result<Vec<T>>
翻页采集(对齐 camoufox Tab::paginate):每页回调 f 收集结果,点 next_selector
直到按钮不存在/不可点/达 max_pages。
Sourcepub fn console(&self) -> ChromiumConsole
pub fn console(&self) -> ChromiumConsole
控制台监听句柄(对标 DP tab.console)。注意:start() 会开 Runtime.enable(反检测取舍)。
Sourcepub fn websocket(&self) -> ChromiumWsListener
pub fn websocket(&self) -> ChromiumWsListener
WebSocket 帧监听句柄(对标 DP 增强):基于 Network 域,不涉及 Runtime.enable。
Sourcepub fn screencast(&self) -> ChromiumScreencast
pub fn screencast(&self) -> ChromiumScreencast
录像/连拍句柄(对标 DP tab.screencast):后台按帧间隔截图存 PNG 帧。
Sourcepub fn debugger(&self) -> ChromiumDebugger
pub fn debugger(&self) -> ChromiumDebugger
调试器句柄(逆向「主动定位」重武器):XHR/事件断点 + 调用栈 + 断点上下文求值/局部变量 +
resume/step + blackbox。详见 ChromiumDebugger。
注意:会开 Debugger.enable(反检测取舍),按需用、用完即停。
Sourcepub fn scripts(&self) -> ChromiumScripts
pub fn scripts(&self) -> ChromiumScripts
脚本源码句柄:dump 全部 JS、全文搜索签名字样、纯 Rust 美化混淆代码。
详见 ChromiumScripts。会开 Debugger.enable(反检测取舍)。
Sourcepub fn hook(&self) -> ChromiumHook
pub fn hook(&self) -> ChromiumHook
JS Hook 工具箱句柄(crypto tap):一键 hook 常见 sink,命中回传参数 + 调用栈;
hook crypto.subtle/CryptoJS 直接偷 key/iv/明文。详见 ChromiumHook。
复用 expose_function 同款基建(Runtime.enable + addBinding,反检测取舍)。
Sourcepub async fn anti_anti_debug(&self) -> Result<()>
pub async fn anti_anti_debug(&self) -> Result<()>
反「无限 debugger」:导航前注入 defuse 脚本,致残 setInterval(debugger) /
Function("debugger")() 等反调试,使断点跟栈不被打断。在导航前调用。
等价 tab.debugger().anti_anti_debug(),
但不开 Debugger 域(自包含、零反检测代价)。
Sourcepub fn intercept(&self) -> CdpIntercept
pub fn intercept(&self) -> CdpIntercept
请求拦截句柄(对标 DP 拦截增强):start/next/stop,请求级 resume/fulfill/abort。
Trait Implementations§
Source§impl Clone for ChromiumTab
impl Clone for ChromiumTab
Source§fn clone(&self) -> ChromiumTab
fn clone(&self) -> ChromiumTab
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl EnvBackend for ChromiumTab
impl EnvBackend for ChromiumTab
Source§impl FingerprintProbe for ChromiumTab
impl FingerprintProbe for ChromiumTab
Source§fn fp_eval<'life0, 'life1, 'async_trait>(
&'life0 self,
js: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Value>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn fp_eval<'life0, 'life1, 'async_trait>(
&'life0 self,
js: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Value>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
run_js)。Source§fn fingerprint_snapshot<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<FingerprintSnapshot>> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'life0: 'async_trait,
fn fingerprint_snapshot<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<FingerprintSnapshot>> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'life0: 'async_trait,
FingerprintSnapshot。 Read moreSource§fn identity_report<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<IdentityReport>> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'life0: 'async_trait,
fn identity_report<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<IdentityReport>> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'life0: 'async_trait,
Source§impl Humanize for ChromiumTab
impl Humanize for ChromiumTab
Source§fn hm_move<'life0, 'async_trait>(
&'life0 self,
x: f64,
y: f64,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn hm_move<'life0, 'async_trait>(
&'life0 self,
x: f64,
y: f64,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Source§fn hm_move_fast<'life0, 'async_trait>(
&'life0 self,
x: f64,
y: f64,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn hm_move_fast<'life0, 'async_trait>(
&'life0 self,
x: f64,
y: f64,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
hm_move(等往返),CDP/Camoufox 覆盖为
fire 快路径——这是轨迹“时间密度“的关键:等往返会把每点间隔抻到 ~20–40ms(行为风控破绽),
fire 由 sleep 控节奏可达 ~50–100Hz,逼近真人(见里程碑 32/61)。fn hm_down<'life0, 'async_trait>(
&'life0 self,
x: f64,
y: f64,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn hm_up<'life0, 'async_trait>(
&'life0 self,
x: f64,
y: f64,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn hm_eval<'life0, 'life1, 'async_trait>(
&'life0 self,
js: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Value>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Source§fn image_view<'life0, 'life1, 'async_trait>(
&'life0 self,
selector: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<ImageView>> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn image_view<'life0, 'life1, 'async_trait>(
&'life0 self,
selector: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<ImageView>> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
selector 元素的 ImageView(显示 rect + 自然尺寸 + src),用于像素→页面映射与取源图。Source§fn human_click<'life0, 'life1, 'async_trait>(
&'life0 self,
points: &'life1 [(f64, f64)],
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn human_click<'life0, 'life1, 'async_trait>(
&'life0 self,
points: &'life1 [(f64, f64)],
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Source§fn human_click_with<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
points: &'life1 [(f64, f64)],
opts: &'life2 HumanClickOpts,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn human_click_with<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
points: &'life1 [(f64, f64)],
opts: &'life2 HumanClickOpts,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Source§impl SliderTab for ChromiumTab
Available on crate feature slider only.
impl SliderTab for ChromiumTab
slider only.Source§fn sl_run_js(&self, js: &str) -> impl Future<Output = Result<Value>>
fn sl_run_js(&self, js: &str) -> impl Future<Output = Result<Value>>
Source§async fn sl_ele_screenshot(&self, css_selector: &str) -> Result<Vec<u8>>
async fn sl_ele_screenshot(&self, css_selector: &str) -> Result<Vec<u8>>
Source§async fn sl_ele_click(&self, css_selector: &str)
async fn sl_ele_click(&self, css_selector: &str)
Auto Trait Implementations§
impl !RefUnwindSafe for ChromiumTab
impl !UnwindSafe for ChromiumTab
impl Freeze for ChromiumTab
impl Send for ChromiumTab
impl Sync for ChromiumTab
impl Unpin for ChromiumTab
impl UnsafeUnpin for ChromiumTab
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
impl<T> CloneAny for T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSend for T
impl<T> DowncastSend for T
Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more