NOTE: This project is released as part of the ShellSpec project, but for now it is not related and can be used independently.
Project Status: Preview Release v0.1.0
This project is in the early stages of development. There are unimplemented features and it has not been fully tested. Incompatible changes may be made. Bug reports and pull requests are welcome!
Documentation for library is not yet available, see webdriver.sh.
#!/bin/sh
set -eu
. ./lib/webdriver.sh
chrome_options() {
echo '{ "args": [] }'
# echo '{ "args": ["--headless"] }'
}
# You need to run the `chromedriver` beforehand
WebDriver driver="$(ChromeDriver chrome_options "http://localhost:9515")"
driver get "https://www.google.com"
WebElement element="$(driver find_element "css selector:[name=q]")"
element send_keys "WebDriver" :enter
# **Shorthand**
# driver find_element "css selector:[name=q]" send_keys "WebDriver" :enter
for element_id in $(driver find_elements "css selector:a"); do
WebElement element="$element_id"
element attribute "text"
done
driver quit
unset -f element driver
- POSIX shell (
dash
,bash
,ksh
,zsh
, etc.) curl
,jq
,base64
- WebDriver
WebDriver | Version |
---|---|
Google Chrome Driver | Tested on 89.0.4389.23 |
Mozilla GeckoDriver | Not yet tested |
Microsoft Edge Driver | Not yet tested |
Opera | Not yet tested |
IEDriver | Not yet tested |
SafariDriver (Builtin) | Not yet tested |
WEBDRIVER_SH_DEBUG
- If set, outputs HTTP logs.
- WebDriver API
- Actions
- HTTP Proxy
- Shadow root
- Bidi API, DevTools (Support for WebSocket is required. Feasible?)
- Additional Functions
- Select
- Conditional Waits
- Events
- Some useful functions
- High level API (?)
- Documentation
- References
- Page object models for shell script
MIT License