Introduction

Shellnium

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

Overview

#!/usr/bin/env bash
source ./selenium.sh
 
main() {
    # Open the URL
    navigate_to 'https://www.google.com'
 
    # Get the search box
    local searchBox=$(find_element 'name' 'q')
 
    # send keys
    send_keys $searchBox "panda\n"
}
 
main

Demo

demo.gif

Methods

Shellnium provides the following methods. Document is here or please see core.sh (opens in a new tab).

  • is_ready
  • new_session
  • delete_session
  • navigate_to
  • get_current_url
  • get_title
  • back
  • forward
  • refresh
  • get_timeouts
  • set_timeouts
  • set_timeout_script
  • set_timeout_pageLoad
  • set_timeout_implicit
  • find_element
  • find_elements
  • find_element_from_element
  • find_elements_from_element
  • get_active_element
  • get_attribute
  • get_property
  • get_css_value
  • get_text
  • get_tag_name
  • get_rect
  • is_element_enabled
  • send_keys
  • click
  • element_clear
  • exec_script
  • screenshot
  • get_window_handle
  • get_window_handles
  • delete_window
  • new_window
  • switch_to_window
  • get_window_rect
  • set_window_rect
  • maximize_window
  • minimize_window
  • fullscreen_window

Bonus Demo

demo2.sh demo2.gif