squirrel-browser-automation

Crates.iosquirrel-browser-automation
lib.rssquirrel-browser-automation
version1.2.0
sourcesrc
created_at2024-01-02 02:29:31.121565
updated_at2024-01-02 02:36:22.111271
descriptionBrowser automation via YAML based workflow definition.
homepagehttps://github.com/goyalmunish/squirrel
repository
max_upload_size
id1085723
size81,396
Munish Goyal (goyalmunish)

documentation

https://crates.io/crates/squirrel-browser-automation

README

Squirrel

Rust YAML Selenium

release Crates.io build license

    ░░░░░░░░░██▄▒█▀▄░▄▀▄░█░░▒█░▄▀▀▒██▀▒█▀▄░░▒▄▀▄░█▒█░▀█▀░▄▀▄░█▄▒▄█▒▄▀▄░▀█▀░█░▄▀▄░█▄░█░░░░░░░░
    ▒░▒░▒░▒░▒█▄█░█▀▄░▀▄▀░▀▄▀▄▀▒▄██░█▄▄░█▀▄▒░░█▀█░▀▄█░▒█▒░▀▄▀░█▒▀▒█░█▀█░▒█▒░█░▀▄▀░█▒▀█▒░▒░▒░▒░
    
                   .^!777!^.                                                        
                 ^5#@@@@@@@&GJ^                               !5^.                  
                ?@@&#&&@@@@@@@@G!                           .J@@&PGJ:               
               .7^:...:~75B@@@@@@G!                  ..:^~?P&@@@@B@@@J              
                           ~5&@@@@@G~         :~?YPGB#&&@@@@@@@@&GPY7.              
                             :?G@@@@@G7.   ^YB&@@@@@@@@@@@@@@@@@G.                  
                                ^?PB&@@BY~Y@@@@@@@@@@@@@@@@@@@@@@&GY?7~:            
                                    .::..P@@@@@@&B5J7~~^^^^^^~!77??7!^.             
                                        5@@@@@#7:                                   
                                       Y@@@@B?.                                     
                                     :G@&GJ~                                        
                                    .#G!.                                           
                                    :5                                              
                                     .
    
    ░░░░░░░░░░░░░░░░░░░░░█░░▒█░█░▀█▀░█▄█░░░░░▄▀▀░▄▀▄░█▒█░█▒█▀▄▒█▀▄▒██▀░█▒░░░░░░░░░░░░░░░░░░░░░
    ▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░░▀▄▀▄▀░█░▒█▒▒█▒█▒░▒░▒▄██░▀▄█░▀▄█░█░█▀▄░█▀▄░█▄▄▒█▄▄▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░

Squirrel revolutionizes browser automation by simplifying the process through YAML based workflow (such as this sample workflow) definition. With Squirrel, you effortlessly automate tasks without getting bogged down by technical intricacies, as the tool handles all the underlying complexities for you.

Here is a glimpse of the above workflow in action:

Sample Workflow in Action

Quick Start

Step 1: Setup Chrome for Testing

Follow these steps to set up Chrome for testing:

Refer Chrome for Testing: reliable downloads for browser automation and Chrome for Testing availability. But, here is the gist:

Download the latest stable Chrome for Testing binary and ChromeDriver:

# Download the latest available Chrome for Testing binary corresponding to the Stable channel.
npx @puppeteer/browsers install chrome@stable

# Download the latest available ChromeDriver version corresponding to the Stable channel.
npx @puppeteer/browsers install chromedriver@stable

Make them executable:

# Setup executables
cd ~
mv chrome chromeDIR
mv chromedriver chromedriverDIR
ln -s chromeDIR/.../Google\ Chrome\ for\ Testing.app Google\ Chrome\ for\ Testing.app
# note: for macOS, drag a copy of Google Chrome for Testing app to "Applications" as well
ln -s chromedriverDIR/.../chromedriver chromedriver

Invoke Chrome Driver:

# Run webdriver
cd ~
./chromedriver --verbose --port=9515 --allowed-origins='*' --allowed-ips='0.0.0.0'

Once the webdriver is running, you may test by connecting to http://0.0.0.0:9515/.

Step 2: Run Squirrel

Option 1: Using Squirrel executable from the Docker image (preferred)

Refer Install Docker Engine for Docker installation.

For docker container to host machine connectivity issues, refer I want to connect from a container to a service on the host.

# Run with sample workflow (with default option of webdriver_url=http://host.docker.internal:9515 and headless_browser=true)
docker run --rm --name squirrel goyalmunish/squirrel

# or, run with your own workflow without headless browser
docker run --rm --name squirrel goyalmunish/squirrel ./src/sample_workflow.yaml http://host.docker.internal:9515 false

Option 2: Using the locally build Squirrel executable

# Clone the repo
git clone git@github.com:goyalmunish/squirrel.git
# cd into projet directory
cd squirrel
# Run with sample workflow (with default option of webdriver_url=http://localhost:9515 and headless_browser=true)
cargo run --release ./src/sample_workflow.yaml

Option 3: Using both Squirrel executable and Web Driver from Docker images (experimental)

Refer:

# Run Selenium Chromium Driver on MacOS (Arm64)
docker run --rm -it -p 4444:4444 -p 7900:7900 --shm-size="2g" -v /dev/shm:/dev/shm --name chrome seleniarm/standalone-chromium:latest

# Run Squirrel
docker run --rm --name squirrel goyalmunish/squirrel ./src/sample_workflow.yaml http://host.docker.internal:4444 false

Development Guide

Build and Push the Docker Image

Make use of build_image.sh to build and push (requires admin rights) Docker image:

# cd into repo
cd squirrel/

# set version, for example
VERSION=v1.0.0

# build images and pushing them
. ./scripts/build_image.sh ${VERSION}
Commit count: 0

cargo fmt