Home

Awesome

<p align="center"> <a href="https://shellnium-site.vercel.app/" target="_blank"> <img widht="500" height="auto" src="https://user-images.githubusercontent.com/17779386/112637471-8a785780-8e81-11eb-898f-c51e9deaba15.png"> </a> <br /> <img alt="" src="https://flat.badgen.net/github/stars/Rasukarusan/shellnium"> <a aria-label="License" href="https://github.com/Rasukarusan/shellnium/blob/master/LICENSE"> <img alt="" src="https://flat.badgen.net/github/license/Rasukarusan/shellnium"> </a> </p>

Shellnium

Shellnium is the selenium WebDriver for Bash.
You can exec selenium simply on your terminal. All you need is Bash or Zsh.

#!/usr/bin/env bash
source ./selenium.sh

main() {
    # Open the URL
    navigate_to 'https://google.com'

    # Get the search box
    local searchBox=$(find_element 'name' 'q')

    # send keys
    send_keys $searchBox "panda\n"
}

main
<img src="https://shellnium-site.vercel.app/demo.gif" width="700" height="auto">

Documentation

https://shellnium-site.vercel.app

If you learn by watching videos, check out this screencast by @gotbletu to explore shellnium features.

shellnium - Automate The Web Using Shell Scripts - Linux SHELL SCRIPT

Quick Start

# Run ChromeDriver before execute script
$ chromedriver

# execute script
$ sh demo.sh

You can add chrome options. e.g. --headless.

$ sh demo.sh --headless --lang=es

Make sure you have the right version of ChromeDriver and GoogleChrome.

# Check the version of Google Chrome
# ex. MacOS
$ /Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --version
Google Chrome 89.0.4389.82

# Check the version of ChromeDriver
$ chromedriver --version
ChromeDriver 89.0.4389.23 (61b08ee2c50024bab004e48d2b1b083cdbdac579-refs/branch-heads/4389@{#294})

Download chromedriver
https://chromedriver.chromium.org/downloads

Requirements

Methods

Shellnium provides the following methods. See document or core.sh for details.

Session

Navigate

Timeouts

Element Retrieval

Element State

Element Interaction

Document

Cookies

Context

Article

English https://dev.to/rasukarusan/shellnium-simple-selnium-webdriver-for-bash-1a9k

Japanese https://qiita.com/Rasukarusan/items/70a54bd38c71a07ff7bd

Example

<img src="https://shellnium-site.vercel.app/demo2.gif" width="700" height="auto">
$ sh demo2.sh

demo2.sh is required iTerm2 and Mac OS.

This script is headless and display chromedriver's behavior as iTerm's background with AppleScript.

Reference

LICENSE

MIT