tauri-plugin-fanto

Crates.iotauri-plugin-fanto
lib.rstauri-plugin-fanto
version0.2.0
sourcesrc
created_at2024-03-09 09:26:30.053791
updated_at2024-06-03 15:47:12.942909
descriptiontauri plugin fantoccini integrated with webdriver-downloader
homepage
repositoryhttps://github.com/seongs1024/tauri-plugin-fanto
max_upload_size
id1167676
size46,784
Seongsu Park (seongs1024)

documentation

https://docs.rs/tauri-plugin-fanto/latest/tauri_plugin_fanto/

README

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");
}
Commit count: 19

cargo fmt