#tauri #tauri-plugin

sys tauri-plugin-fanto

tauri plugin fantoccini integrated with webdriver-downloader

2 unstable releases

0.2.0 Jun 3, 2024
0.1.1 Mar 10, 2024
0.1.0 Mar 9, 2024

#54 in #tauri

Download history 11/week @ 2024-08-08 16/week @ 2024-08-15 11/week @ 2024-09-19 15/week @ 2024-09-26 10/week @ 2024-10-03

296 downloads per month

MIT/Apache

17KB
349 lines

Tauri Plugin fanto

Fantoccini integrated with webdriver downloader

Install

src-tauri/Cargo.toml

[dependencies]
tauri-plugin-fanto = "0.2.0"

Usage

src-tauri/src/main.rs

use tauri::AppHandle;
use tauri_plugin_fanto::{
    FantoExt,
    fantoccini::{
        Locator,
        key::Key,
    },
    Error,
};

#[tauri::command]
async fn greet(app: tauri::AppHandle) -> Result<(), Error> {
    let fanto = app.fanto();

    let driver = fanto.driver().await?;

    driver.goto("https://www.example.com").await?;
    driver.find(Locator::XPath("//a")).await?
        .click().await?;

    Ok(())
}

fn main() {
    tauri::Builder::default()
        .plugin(tauri_plugin_fanto::init())
        .invoke_handler(tauri::generate_handler![greet])
        .run(tauri::generate_context!())
        .expect("error while running tauri application");
}

Dependencies

~28–73MB
~1M SLoC