Cross-platform WebDriver server for Tauri applications.
This is a WebDriver Intermediary Node that works with tauri-plugin-webdriver
to provide WebDriver automation for Tauri apps on macOS, Windows, and Linux.
Your WebDriver client connects to tauri-webdriver, which launches your Tauri
app and proxies requests to the embedded plugin. It requires two separate ports
since two distinct WebDriver Remote Ends run.
| Platform | WebDriver Backend |
|---|---|
| macOS | tauri-plugin-webdriver (embedded in app) |
| Windows | tauri-plugin-webdriver (embedded in app) |
| Linux | tauri-plugin-webdriver (embedded in app) |
cargo install tauri-webdriver --locked--port(default:4444) - Port for tauri-webdriver to listen on--native-port(default:4445) - Port of the plugin WebDriver--native-host(default:127.0.0.1) - Host of the plugin WebDriver
On all platforms, tauri-webdriver works with tauri-plugin-webdriver, which
embeds a W3C WebDriver server directly inside your Tauri application. This provides
native WebView control (WKWebView on macOS, WebView2 on Windows, WebKitGTK on Linux)
without external dependencies.
cargo add tauri-plugin-webdriver// src-tauri/src/main.rs
fn main() {
tauri::Builder::default()
.plugin(tauri_plugin_webdriver::init())
.run(tauri::generate_context!())
.expect("error running app");
}cargo tauri buildStart tauri-webdriver:
tauri-webdriverConfigure your WebDriver client to connect to localhost:4444 with
tauri:options pointing to your app binary and optional arguments with args:
// macOS
{
"capabilities": {
"alwaysMatch": {
"tauri:options": {
"application": "/path/to/YourApp.app/Contents/MacOS/YourApp",
"args": ["--optional-field", "--another-arg"]
}
}
}
}
// Windows
{
"capabilities": {
"alwaysMatch": {
"tauri:options": {
"application": "C:\\path\\to\\YourApp.exe",
"args": ["--optional-field", "--another-arg"]
}
}
}
}
// Linux
{
"capabilities": {
"alwaysMatch": {
"tauri:options": {
"application": "/path/to/your-app",
"args": ["--optional-field", "--another-arg"]
}
}
}
}When a session is created, tauri-webdriver will:
- Launch your Tauri app with WebDriver automation enabled
- Wait for the plugin's HTTP server to be ready
- Proxy all WebDriver requests to the plugin
- Terminate the app when the session is deleted
// wdio.conf.ts
export const config = {
runner: 'local',
specs: ['./test/**/*.ts'],
capabilities: [{
'tauri:options': {
application: './src-tauri/target/release/bundle/macos/YourApp.app/Contents/MacOS/YourApp'
}
}],
hostname: 'localhost',
port: 4444,
path: '/'
}// test/example.ts
describe('Tauri App', () => {
it('should load the page', async () => {
const title = await browser.getTitle()
expect(title).toBe('My Tauri App')
})
it('should find elements', async () => {
const button = await $('button#submit')
await button.click()
})
})For more details, see the Tauri WebDriver documentation: https://tauri.app/develop/tests/webdriver/