Skip to main content

Tab

Struct Tab 

Source
pub struct Tab { /* private fields */ }
Available on crate feature camoufox only.
Expand description

一个浏览器标签页句柄。克隆代价低(共享内核)。

Implementations§

Source§

impl Tab

Source

pub async fn pass_cloudflare_default(&self) -> Result<bool>

自动通过 Cloudflare 挑战(默认 30s 超时)。见 pass_cloudflare

Source

pub async fn pass_cloudflare(&self, timeout: Duration) -> Result<bool>

timeout 内尝试通过 Cloudflare 挑战:

  • 已经不是挑战页 → 立即返回 true;
  • 发现 Turnstile 复选框 → 拟人移动 + 可信点击,等待放行;
  • 只有非交互式挑战(无复选框)→ 轮询等待其自动放行。

返回是否在超时内通过。非破坏:不是挑战页时等价于一次轻量探测后立即返回。

Source

pub async fn is_cloudflare(&self) -> Result<bool>

当前是否处于 Cloudflare 挑战页(轻量探测,不点击)。

Source

pub async fn cloudflare_debug(&self) -> Result<Value>

CF 诊断信息(页面所有 iframe + 关键标记),用于排查“点歪/没点“。

Source§

impl Tab

Source

pub async fn slider_gap(&self, cfg: &SliderConfig) -> Result<SliderGap>

Available on crate feature slider only.

纯视觉:按 SliderConfig 读图、自动选缺口算法,算出拼图需要水平移动的距离(SliderGap)。 要求验证图已显示。读图失败 / 无有效结果返回 Err

Source

pub async fn solve_slider(&self, cfg: &SliderConfig) -> Result<SliderResult>

Available on crate feature slider only.

一把梭:弹出→匹配→闭环拟人拖动→判定→非通过换图重试。返回 SliderResult

Source

pub async fn geetest_slide_gap(&self) -> Result<SliderGap>

Available on crate feature slider only.

极验 v4 滑块缺口(预设 SliderConfig::geetest_v4slider_gap)。

Source

pub async fn solve_geetest_slide(&self) -> Result<SliderResult>

Available on crate feature slider only.

一把梭求解极验 v4 滑块(预设 SliderConfig::geetest_v4solve_slider)。 要调尝试次数等用 solve_slider(&SliderConfig::geetest_v4().max_attempts(8))

Source

pub async fn dingxiang_slide_gap(&self, index: u32) -> Result<SliderGap>

Available on crate feature slider only.

顶象滑块缺口(预设 SliderConfig::dingxiangslider_gap,index=实例后缀)。

Source

pub async fn solve_dingxiang_slide( &self, index: u32, open: Option<&str>, ) -> Result<SliderResult>

Available on crate feature slider only.

一把梭求解顶象滑块(预设 SliderConfig::dingxiang)。弹出式传 open 触发按钮(如 #btn-popup)。 注:顶象 demo 对自动化拖动有轨迹/IP 行为风控会弹回(与缺口算法无关);本方法只保证缺口找得准 + 拖到位。要自定义尝试次数等改用 solve_slider(&SliderConfig::dingxiang(i)...)

Source§

impl Tab

Source

pub async fn storage_state(&self) -> Result<StorageState>

导出当前登录态:全部 cookie + 当前源的 localStorage / sessionStorage。

Source

pub async fn save_storage_state(&self, path: &str) -> Result<()>

导出并存盘(JSON)。

Source

pub async fn load_storage_state(&self, path: &str) -> Result<()>

从磁盘读回并应用(cookie 全量;storage 仅应用与当前源匹配的那组)。

Source

pub async fn apply_storage_state(&self, state: &StorageState) -> Result<()>

应用一个 StorageState(应用语义同 load_storage_state)。

Source§

impl Tab

Source

pub fn session_id(&self) -> &str

该标签的 page 会话 id。

Source

pub fn browser_context_id(&self) -> &str

该标签独立 BrowserContext 的 id。

Source

pub fn target_id(&self) -> &str

该标签对应的 targetId。

Source

pub async fn get(&self, url: &str) -> Result<bool>

访问网址。返回是否加载成功(DP 语义:bool)。

默认按标签当前加载模式(默认 LoadMode::Normal,等 load)等待;失败不报错,返回 false。 需要重试 / 自定义超时 / 加载模式时用 get_with

Source

pub async fn get_with(&self, url: &str, opts: &GetOptions) -> Result<bool>

访问网址(带选项:重试 / 间隔 / 超时 / 加载模式 / referer)。返回是否加载成功。

Source

pub async fn url(&self) -> Result<String>

当前 URL。

Source

pub async fn title(&self) -> Result<String>

页面标题。

Source

pub async fn html(&self) -> Result<String>

当前 DOM 的 HTML。

Source

pub async fn run_js(&self, script: &str) -> Result<Value>

执行 JS 表达式,返回其值(JSON)。

Source

pub async fn ax_snapshot(&self) -> Result<AxTree>

DOM 派生的无障碍快照(注入 AX_SNAPSHOT_JS 按 ARIA 规则算): 把页面压成 role "name" 语义树,用于抗改版断言或喂 LLM。与 CDP 后端 ax_snapshot() 同实现、 结果一致(Camoufox 无 CDP 的 Accessibility 域,故不提供 ax_tree() 原生版)。

Source

pub async fn set_content(&self, html: &str) -> Result<()>

直接把页面文档内容设为 html(对标 Playwright/Puppeteer set_content;Juggler 无原生命令,走 JS)。

Source

pub async fn user_agent(&self) -> Result<String>

当前页面的 navigator.userAgent

Source

pub async fn ready_state(&self) -> Result<String>

当前 document.readyState(loading/interactive/complete)。

Source

pub fn url_available(&self) -> bool

最近一次 get 是否成功(DP 的 url_available)。同步读取,不发协议请求。

Source

pub async fn stop_loading(&self) -> Result<()>

停止当前页面加载(等价 JS window.stop();Juggler 无独立 stopLoading 方法)。

Source

pub async fn wait_loaded(&self) -> Result<bool>

等待文档加载完成(readyState === 'complete')。超时返回 false(不报错)。

Source

pub async fn handle_next_dialog( &self, accept: bool, prompt_text: Option<&str>, ) -> Result<DialogInfo>

等待并处理下一个 JS 对话框(alert/confirm/prompt/beforeunload)。

accept:确定/取消;prompt_text:prompt 时填入的文本。返回该对话框信息。 若 JS(如 confirm())会阻塞页面,请与触发动作并发调用(见 examples/page_extras)。

Source

pub async fn set_upload_files(&self, paths: &[&str]) -> Result<()>

设置“自然上传“要用的文件并武装文件选择器拦截(对应 DP tab.set.upload_files)。

调用后,下一次任何会弹出文件选择框的点击都不再弹原生窗,而是把这些文件直接填进去。 典型用法:set_upload_files → 点击触发按钮 → wait_upload_paths_inputtedpaths 为本地文件绝对路径(多文件需被触发的 <input>multiple)。

Element::set_files 的区别:set_files 直接对已知的 <input type=file> 赋值;本方法处理 “点按钮→系统文件框“这种没有可直接定位的 input(或 input 隐藏、由 JS input.click() 唤起)的场景。

Source

pub async fn wait_upload_paths_inputted( &self, timeout: Option<Duration>, ) -> Result<bool>

等待“自然上传“的文件路径被填入(对应 DP tab.wait.upload_paths_inputted)。

配合 set_upload_files + 点击触发使用。timeout=None 用默认超时; 超时返回 false(不报错)。

Source

pub async fn reload(&self) -> Result<()>

重新加载。

Source

pub async fn back(&self) -> Result<()>

后退。

Source

pub async fn forward(&self) -> Result<()>

前进。

Source

pub async fn ele(&self, selector: &str) -> Result<Element>

查找单个元素(DP 定位语法)。在超时内轮询等待出现。

Source

pub async fn click(&self, selector: &str) -> Result<()>

便捷:找到并点击(= ele(selector).await?.click().await)。把最常见的「定位 + 点击」合一, 少写一次 .await?ele 自带超时内等待,故元素稍后才出现也能点到。

Source

pub async fn input(&self, selector: &str, text: &str) -> Result<()>

便捷:找到并输入(= ele(selector).await?.input(text).await)。 需要逐字符拟人输入用 ele(selector).await?.input_human(text);输入前清空用 ele().clear()

Source

pub async fn exists(&self, selector: &str) -> Result<bool>

元素是否存在(立即判定、不等待)。要“等它出现“用 elewait().ele_displayed;要静态 HTML 判定用 s_ele

Source

pub async fn s_root(&self) -> Result<StaticElement>

解析当前页面 HTML,返回静态根元素(离线解析,不再与浏览器通信)。

Source

pub async fn s_ele(&self, selector: &str) -> Result<StaticElement>

解析当前页面 HTML,取第一个匹配的静态元素(DP s_ele)。

适合“抓到页面后批量离线解析“。CSS/@attr/text:xpath:(内置子集)均支持。

Source

pub async fn s_eles(&self, selector: &str) -> Result<Vec<StaticElement>>

解析当前页面 HTML,取全部匹配的静态元素(DP s_eles)。

Source

pub async fn get_frame(&self, selector: &str) -> Result<Frame>

按定位语法找到一个 <iframe>/<frame> 元素,返回其内容 Frame(DP tab.get_frame)。

Source

pub async fn eles(&self, selector: &str) -> Result<Vec<Element>>

查找多个元素(立即返回,不等待)。

Source

pub async fn paginate<F, Fut, T>( &self, next_selector: &str, max_pages: usize, f: F, ) -> Result<Vec<T>>
where F: FnMut(usize) -> Fut, Fut: Future<Output = Result<T>>,

翻页采集:对每一页调用 f 收集结果,然后点击 next_selector 翻到下一页,直到 下一页按钮不存在 / 不可点击,或达到 max_pages。返回每页结果(按页序)。

f(page_index)当前页就绪后被调用(第 0 页即首屏)。点下一页后会等一小段让新页渲染; 若站点是 AJAX 局部刷新、需要更精确的“等新内容“逻辑,可在 f 内部自行 wait 后再抓。 闭包通常捕获一个 tab.clone() 在内部读元素(避免与本方法的 &self 借用冲突)。

let t = tab.clone();
let pages = tab.paginate("css:.next:not(.disabled)", 10, move |i| {
    let t = t.clone();
    async move { t.ele("tag:table").await?.table().await }
}).await?;
Source

pub async fn cookies(&self) -> Result<Vec<Cookie>>

读取本标签(其 BrowserContext)的所有 cookie。

Source

pub async fn set_cookies(&self, cookies: Vec<CookieParam>) -> Result<()>

为本标签(其 BrowserContext)设置 cookie。

Source

pub async fn wait_download(&self, timeout: Duration) -> Result<DownloadInfo>

等待本页触发的一次下载完成,返回 DownloadInfo。 需先用 BrowserOptions::download_path 设下载目录。

实现:文件系统跟踪。实测当前 Camoufox/Juggler 构建不下发 Browser.download* 事件, 但文件会可靠落盘(下载中写 <name>.part、完成后改名)。本方法在调用时记录目录基线,然后轮询 等待新出现且写入稳定的文件。因走文件系统,DownloadInfo::url 为空(文件名/路径可用)。 调用顺序:先触发动作、再等(基线在本方法内记录,故 click 在前也可):

link.click().await?;
let info = tab.wait_download(Duration::from_secs(30)).await?;  // info.path 即下载到的文件

多文件 / 任务列表 / 进度 / 重命名请用句柄式 downloads()

Source

pub async fn listen_start(&self, keywords: &[&str]) -> Result<()>

开始网络监听。keywords 为 URL 子串过滤(空=全部)。

实现:在页面注入 fetch/XHR hook(当前文档 + 后续导航),匹配的请求连同响应体入队, 由 listen_wait/listen_next 取回。 务必在 get 之前调用,以免漏掉早期请求。

Source

pub async fn listen_xhr(&self, keywords: &[&str]) -> Result<()>

监听(关键词过滤)。hook 天然只覆盖 fetch/XHR,与 listen_start 等价。

Source

pub async fn listen_wait(&self) -> Result<DataPacket>

等待下一个匹配的数据包(带默认超时)。

Source

pub async fn listen_wait_timeout(&self, timeout: Duration) -> Result<DataPacket>

等待下一个匹配的数据包(自定义超时)。供 listen_waitListenStream 复用。单次模式下会按需 drain;长监听模式下仅从缓冲 pop(后台任务负责 drain)。

Source

pub async fn listen_next(&self) -> Result<Option<DataPacket>>

取下一个数据包(带默认超时;超时返回 None)。

Source

pub async fn listen_forever(&self) -> Result<()>

开启长监听:启动后台抽取任务,持续把页面队列搬进本地缓冲(不丢包)。

需先调用 listen_start/listen_xhr 安装 hook。 幂等:重复调用不会重复 spawn。与单次抓取共用同一缓冲,互不冲突。

Source

pub async fn listen_stream(&self) -> Result<ListenStream>

开启长监听并返回一个流式句柄,适合“边滑边持续抓“的场景。

tab.listen_xhr(&["aweme/v1/web/aweme/detail"]).await?;
tab.get(url).await?;
let stream = tab.listen_stream().await?;
while let Some(p) = stream.next_timeout(Duration::from_secs(15)).await? {
    // 处理 p ...
    tab.press_key("ArrowDown").await?; // 滑到下一个视频
}
Source

pub async fn listen_stop(&self) -> Result<()>

停止监听并清空状态(同时停掉长监听后台任务)。保留通过 add_init_script 注入的通用脚本(只移除 listen 自己的 hook)。

Source

pub async fn add_init_script(&self, script: &str) -> Result<()>

添加一个【导航前注入】脚本:在每个新文档最早期(优先于页面自身脚本)执行,并立即在当前 文档执行一次。适合补环境 / 吐环境探针 / 反检测注入。与 listen 的 hook 共存(合并下发)。

务必在 get 之前调用,才能保证新文档里目标脚本运行前探针已就位。

Source

pub async fn apply_pointer_stealth(&self) -> Result<()>

注入「输入指纹」反检测:把合成 PointerEvent 的空 pointerType 修补成 "mouse"

背景:经 Page.dispatchMouseEvent 派发的鼠标事件虽是可信事件(isTrusted=true)、也能正确 衍生 movementX/YscreenX/Ypressure,但 Firefox/Juggler 从合成鼠标事件衍生的 PointerEvent 的 pointerType 为空串 ""(真实鼠标应为 "mouse")——这是滑块/行为风控 (如 GeeTest)用来识别自动化输入的一个破绽。本方法用一个轻量 getter 补丁把空值改回 "mouse",只改这一处、不动 Function.prototype.toString(不引入更大的可扫描面)。

必须在导航前调用(经 add_init_script 在每个新文档脚本运行前生效)。

Source

pub fn dump_env(&self) -> EnvDumper

通用吐环境入口:链式指定目标参数(query/header/cookie)与范围后 start() 注入探针。 详见 dump_env 模块。

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")?;
Source

pub async fn press_key(&self, key: &str) -> Result<()>

模拟按键(keydown+keyup)。内置常用导航键映射;抖音切下一个视频用 press_key("ArrowDown")

Source

pub async fn wheel(&self, delta_x: f64, delta_y: f64) -> Result<()>

在视口中心派发鼠标滚轮(deltaY>0 向下)。抖音切视频的备选触发方式。

Source

pub async fn wheel_at( &self, x: f64, y: f64, delta_x: f64, delta_y: f64, ) -> Result<()>

在指定坐标派发鼠标滚轮。

Source

pub async fn scroll_by(&self, x: f64, y: f64) -> Result<()>

页面级滚动(window.scrollBy)。普通页面通用;抖音 feed 不一定切视频。

Source

pub async fn mouse_move(&self, x: f64, y: f64) -> Result<()>

低层鼠标:移动到视口坐标 (x,y)(左键未按下)。

Source

pub async fn mouse_down(&self, x: f64, y: f64) -> Result<()>

低层鼠标:在 (x,y) 按下左键。

Source

pub async fn mouse_drag(&self, x: f64, y: f64) -> Result<()>

低层鼠标:按住左键移动到 (x,y)(拖拽过程中的 move,buttons=1)。

Source

pub async fn mouse_up(&self, x: f64, y: f64) -> Result<()>

低层鼠标:在 (x,y) 松开左键。

Source

pub fn mouse_move_fast(&self, x: f64, y: f64) -> Result<()>

低层鼠标(不等待往返):移动到 (x,y)(左键未按下)。

节奏由调用方 sleep 控制,可达真人级 ~10ms 采样;适合拟人轨迹中不需要读返回值的密集移动。 需要边移边读位置(如滑块对齐纠偏)时,仍用会等待的 mouse_move 等。

Source

pub fn mouse_drag_fast(&self, x: f64, y: f64) -> Result<()>

低层鼠标(不等待往返):按住左键移动到 (x,y)(拖拽中的 move,buttons=1)。

Source

pub fn wait(&self) -> Wait

等待相关操作的句柄(对应 DP tab.wait):doc_loaded / ele_displayed / ele_loaded / …。

Source

pub fn scroll(&self) -> Scroll

滚动相关操作的句柄(对应 DP tab.scroll):to_top / to_bottom / to_location / …。

Source

pub fn set(&self) -> SetTab

设置相关操作的句柄(对应 DP tab.set):cookies / timeout / load_mode / user_agent

Source

pub fn listen(&self) -> Listen

网络监听句柄(对应 DP tab.listen):start / wait / wait_count / steps / stop

与扁平的 listen_start/listen_wait/listen_stream/listen_stop 等价(底层复用), 提供更贴近 DrissionPage 的句柄式写法。

Source

pub fn console(&self) -> Console

控制台监听句柄(对应 DP tab.console):start / wait / messages / steps / stop

基于 Juggler 原生 Runtime.console 事件(不 hook 页面 console,对反检测更友好)。 console.log() 等输出到控制台的内容才能获取。

Source

pub fn websocket(&self) -> WsListener

WebSocket 帧监听句柄(drission-rs 增强):start / wait / wait_count / messages / sockets / steps / stop

基于 Juggler 原生 Page.webSocket* 事件(不 hook 页面 WebSocket,对反检测更友好): 抓取页面 WebSocket 收发的每一帧(文本 / 二进制)。务必在建立连接之前 start()

let ws = tab.websocket();
ws.start_with(WsFilter::new().url_contains("/im/")).await?;
tab.get(url).await?;
while let Some(m) = ws.wait(Some(Duration::from_secs(10))).await? {
    if m.is_text() { println!("{} {}", m.direction.as_str(), m.text().unwrap()); }
}
Source

pub fn actions(&self) -> Actions

动作链(对应 DP tab.actions / Selenium ActionChains):把鼠标/键盘动作链式串起来, perform().await 一次执行。最典型用途是拖放:

tab.actions().move_to_ele(&src).hold().move_to_ele(&dst).release().perform().await?;
Source

pub fn intercept(&self) -> Intercept

请求拦截句柄(对应 DP 风格;与 listen()/console()/websocket() 句柄风格统一)。

把扁平的 intercept_start/intercept_xhr/intercept_next/intercept_stop 收敛成句柄式 (底层完全复用,不改变既有行为):

tab.intercept().start(&["/api/"]).await?;   // 务必在 get 之前
tab.get(url).await?;
let req = tab.intercept().next().await?;     // 取一个被拦请求
req.fulfill(200, vec![], "{\"ok\":true}").await?;  // 伪造响应(或 resume/abort/resume_with)
tab.intercept().stop().await?;
Source

pub fn downloads(&self) -> Downloads

下载管理句柄(对标 DP DownloadManager):start/wait_done/wait_count_done/missions/stop

后台收集本标签触发的多个下载,支持任务列表、自定义重命名([DownloadMission::save_as])、 best-effort 进度([DownloadMission::downloaded_bytes])。需先用 BrowserOptions::download_path 设下载目录。 一次性等单个下载用 wait_download 即可。

Source

pub fn screencast(&self) -> Screencast

录像句柄(对应 DP tab.screencast):set_save_path / set_mode / set_fps / start / stop

大道至简实现 = 后台按帧间隔反复截视口存帧;Video 模式停止时用 ffmpeg 合成 mp4。

let cast = tab.screencast();
cast.set_save_path("video").set_mode(ScreencastMode::Imgs).set_fps(10.0);
cast.start(None).await?;
tab.wait().secs(3.0).await;
let out = cast.stop().await?;   // 帧目录(imgs)或 mp4(video)
Source

pub async fn screenshot_bytes(&self, full_page: bool) -> Result<Vec<u8>>

截图,返回 PNG 字节。full_page=true 截整页(按文档滚动尺寸),否则截当前视口。

要 JPEG / 指定区域 / 调质量,用 screenshot + ShotOpts

Source

pub async fn screenshot_base64(&self, full_page: bool) -> Result<String>

截图,返回 base64 字符串(对应 DP get_screenshot(as_base64=...))。默认 PNG。

Source

pub async fn screenshot(&self, opts: &ShotOpts) -> Result<Vec<u8>>

ShotOpts 截图,返回图片字节(支持整页 / 指定区域 / 格式 / JPEG 质量)。

let png = tab.screenshot(&ShotOpts::new().full_page(true)).await?;
let jpg = tab.screenshot(&ShotOpts::new().format(ImageFormat::Jpeg).quality(80)).await?;
let area = tab.screenshot(&ShotOpts::new().region((0.0, 0.0), (300.0, 200.0))).await?;
Source

pub async fn get_screenshot( &self, path: impl AsRef<Path>, full_page: bool, ) -> Result<PathBuf>

截图并保存到 path。格式按 path 后缀自动选(.jpg/.jpeg→JPEG,其余 PNG)。 返回写入的路径;父目录不存在会自动创建。

Source

pub async fn size(&self) -> Result<(f64, f64)>

可视视口尺寸 (innerWidth, innerHeight)

Source

pub async fn page_size(&self) -> Result<(f64, f64)>

整个文档内容尺寸 (scrollWidth, scrollHeight)

Source

pub async fn rect(&self) -> Result<PageRect>

一次取回页面尺寸/滚动/DPR 信息(见 PageRect)。

Source

pub async fn intercept_start(&self, keywords: &[&str]) -> Result<()>

开始请求拦截。keywords 为 URL 子串过滤(空=拦截所有请求)。

匹配过滤的请求通过 intercept_next 交给你决策 (放行 / 改写 / 伪造 / 中止);不匹配的请求由库自动放行,避免页面卡死。

Source

pub async fn intercept_xhr(&self, keywords: &[&str]) -> Result<()>

仅拦截 XHR/fetch 类请求(其余自动放行)。

Source

pub async fn intercept_next(&self) -> Result<InterceptedRequest>

等待下一个被拦截的请求(带默认超时)。拿到后必须调用其 resume / resume_with / fulfill / abort 之一放行。

Source

pub async fn intercept_next_timeout( &self, timeout: Duration, ) -> Result<Option<InterceptedRequest>>

等待下一个被拦截的请求(自定义超时;超时返回 None,不报错)。

Source

pub async fn intercept_stop(&self) -> Result<()>

停止拦截并清空状态。

Source

pub async fn close(&self) -> Result<()>

关闭该标签页(同时移除其 BrowserContext)。

Source§

impl Tab

Tab::ocr_image 便捷方法(需 Camoufox 后端的 Tab)。

Source

pub async fn ocr_image(&self, selector: &str) -> Result<String>

Available on crate feature ocr only.

一步识别页面里某元素的验证码图:定位 selector(css:/xpath: 前缀,同 Tab::ele)→ 取图(<img>data: URL 直接解码,否则元素截图)→ ddddocr 模型识别 → 文本。 首次调用会懒加载默认模型(可能下载 ~54MB)。

Trait Implementations§

Source§

impl Clone for Tab

Source§

fn clone(&self) -> Tab

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl EnvBackend for Tab

Source§

fn add_init_script(&self, script: &str) -> impl Future<Output = Result<()>>

Available on crate features camoufox or cdp only.
导航前注入脚本(每个新文档最早期执行),并尽量在当前文档也执行一次。
Source§

fn run_js(&self, expr: &str) -> impl Future<Output = Result<Value>>

Available on crate features camoufox or cdp only.
在页面执行 JS 表达式,返回结果值。
Source§

impl FingerprintProbe for Tab

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,

底层求值(各后端委托给固有 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,

读取当前页面的实时 FingerprintSnapshotRead more
Source§

impl Humanize for Tab

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,

底层:可信移动 / 按下 / 抬起 / 求值(各后端委托给固有方法)。
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,

不等往返的密集移动(拟人轨迹用)。默认回退到 hm_move(等往返),CDP/Camoufox 覆盖为 fire 快路径——这是轨迹“时间密度“的关键:等往返会把每点间隔抻到 ~20–40ms(行为风控破绽), fire 由 sleep 控节奏可达 ~50–100Hz,逼近真人(见里程碑 32/61)。
Source§

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,

Source§

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,

Source§

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,

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,

依次拟人点击多个页面坐标点(默认参数)。
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,

human_click,可定制 HumanClickOpts。点间走连续曲线轨迹(密集 mousemove)+ 落点微停 + 可信按下/抬起;首点之前从其上方一随机点移入(模拟从别处移过来)。

Auto Trait Implementations§

§

impl !RefUnwindSafe for Tab

§

impl !UnwindSafe for Tab

§

impl Freeze for Tab

§

impl Send for Tab

§

impl Sync for Tab

§

impl Unpin for Tab

§

impl UnsafeUnpin for Tab

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneAny for T
where T: Any + Clone,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> Downcast for T
where T: Any,

Source§

fn into_any(self: Box<T>) -> Box<dyn Any>

Converts 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>

Converts 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)

Converts &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)

Converts &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
where T: Any + Send,

Source§

fn into_any_send(self: Box<T>) -> Box<dyn Any + Send>

Converts Box<Trait> (where Trait: DowncastSend) to Box<dyn Any + Send>, which can then be downcast into Box<ConcreteType> where ConcreteType implements Trait.
Source§

impl<T> DowncastSync for T
where T: Any + Send + Sync,

Source§

fn into_any_sync(self: Box<T>) -> Box<dyn Any + Send + Sync>

Converts Box<Trait> (where Trait: DowncastSync) to Box<dyn Any + Send + Sync>, which can then be downcast into Box<ConcreteType> where ConcreteType implements Trait.
Source§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Send + Sync>

Converts Arc<Trait> (where Trait: DowncastSync) to Arc<Any>, which can then be downcast into Arc<ConcreteType> where ConcreteType implements Trait.
Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more