#tauri-plugin #tauri #plugin #selenium #fantoccini #webdriver-downloader

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

#1091 in GUI

36 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–72MB
~1M SLoC