Not sure what I am looking for

I am trying figure out how to use a program to click a button on a web page. We use a dynamic web page to change settings on a Unit. Doing this manually is a pain. I have recently found Rust and like how it is designed. I would love to try and create a program using Rust to do exactly this. To be honest though I am not even sure how I could do this in any language. If someone could point me in the right direction I would appreciate it.
Thanks, Brian

The key-phrase of interest is rust webdriver.

I have not used the thirtyfour crate. It looks well written and useful. I have used the lower level crate fantoccini. It works well.

If the web elements of interest are reasonably tagged (have good CSS selectors) then the work is fairly easy. As with everything that intersects web browsers, there will be quirks. For example, trying to programmatically click an element can fail even though clicking that same element interactively using a mouse works. I had to build up a few helpers that try harder (use JavaScript) to do things like click and set inputs.

Firefox is a treat. The WebDriver is actually installed using cargo.

Chrome is a bit annoying. You have to download the version matching WebDriver then manually install it. (macOS does not like that at all)

Looks like a good place to start! Thanks

1 Like

Thanks for the help. I'm making a start with Fantoccini but I'm struggling with the first step, getting a toy example to work. All the exaples provided in that crate use tokio which I haven't used before and don't know how to setup. For example, the line


gives me the error "Failed to resolve: could not find main in tokio". So I appear to be missing some fairly fundamental part of the picture. Sorry to be a bother but could you help again?

If you're getting started with tokio as a user, you almost always want to turn on the "full" feature so everything Just Works :tm:

If that's the only feature you turn on, your tokio entry in Cargo.toml should look like

tokio = { version = "1", features = ["full"] }

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.