tbmreza / example-async-app

a work in progress

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

example-async-app

github

This is a REPL program for interacting with ChromeDriver.

The program intends to replace graphical browsers from a web developer's debugging workflow. When hunting for a JavaScript bug, a common flow is to modify the source code adding log statements, and then switch to browser to view its console. At developer's preference, tasks where a headless Chrome would suffice can be performed without context switching to another GUI.

This repo mainly serves as an example of a Selenium WebDriver client (thirtyfour), an async (tokio), and in general a REPL (rustyline) app.


Requirements

thirtyfour does support Firefox, which means we can also use geckodriver (which runs marionette). However, marionette doesn't support non-W3C method get_log. Capturing browser log requires a geckodriver specific config, which isn't implemented yet.


Testing

The test suite depends on chromedriver already running.

# cat test.sh
if [ $(pgrep -f chromedriver) ]
then
	cargo test
else
	chromedriver --port=4444 & cargo test
fi

cargo test intentionally doesn't stop chromedriver process on completion (because restarting the program takes considerable seconds). Manually kill it using pkill -f chromedriver, for example.

Common Errors

"This version of ChromeDriver only supports Chrome version xx"

If chrome updates automatically but chromedriver doesn't, this error will show up quite often. Either replace chromedriver binary manually from https://chromedriver.chromium.org/downloads, or invoke your package manager's upgrade command on chromedriver.

nix-env -iA nixpkgs.chromedriver 

License

Licensed under either of Apache License, Version 2.0 or MIT license at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in this crate by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

About

a work in progress

License:Apache License 2.0


Languages

Language:Rust 99.3%Language:Shell 0.7%