get_driver_executable

Function get_driver_executable 

Source
pub fn get_driver_executable() -> Result<(PathBuf, PathBuf)>
Expand description

Get the path to the Playwright driver executable

This function attempts to locate the Playwright driver in the following order:

  1. Bundled driver downloaded by build.rs (PRIMARY - matches official bindings)
  2. PLAYWRIGHT_DRIVER_PATH environment variable (user override)
  3. PLAYWRIGHT_NODE_EXE and PLAYWRIGHT_CLI_JS environment variables (user override)
  4. Global npm installation (npm root -g) (development fallback)
  5. Local npm installation (npm root) (development fallback)

Returns a tuple of (node_executable_path, cli_js_path).

§Errors

Returns Error::ServerNotFound if the driver cannot be located in any of the search paths.

§Example

use playwright_core::driver::get_driver_executable;

let (node_exe, cli_js) = get_driver_executable()?;
println!("Node: {}", node_exe.display());
println!("CLI:  {}", cli_js.display());