Crates.io | tauri-plugin-fanto |
lib.rs | tauri-plugin-fanto |
version | 0.2.0 |
source | src |
created_at | 2024-03-09 09:26:30.053791 |
updated_at | 2024-06-03 15:47:12.942909 |
description | tauri plugin fantoccini integrated with webdriver-downloader |
homepage | |
repository | https://github.com/seongs1024/tauri-plugin-fanto |
max_upload_size | |
id | 1167676 |
size | 46,784 |
Fantoccini integrated with webdriver downloader
src-tauri/Cargo.toml
[dependencies]
tauri-plugin-fanto = "0.2.0"
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");
}