All Projects → thesis → shale

thesis / shale

Licence: MIT license
A Clojure-backed replacement for Selenium hubs.

Programming Languages

clojure
4091 projects
CSS
56736 projects

Projects that are alternatives of or similar to shale

Selenium Java Lean Test Achitecture
Ready to use Lean Test Automation Architecture using Java and Selenium WebDriver to speed up your test automation
Stars: ✭ 152 (+985.71%)
Mutual labels:  selenium-webdriver
Cdp4j
cdp4j - Chrome DevTools Protocol for Java
Stars: ✭ 232 (+1557.14%)
Mutual labels:  selenium-webdriver
WhatsAppBulkMessenger
This tools sends WhatsApp messages and invites directly to people on WhatsApp itself, without saving their contacts 🌠
Stars: ✭ 73 (+421.43%)
Mutual labels:  selenium-webdriver
Selenium Remote Driver
Perl Bindings to the Selenium Webdriver server
Stars: ✭ 169 (+1107.14%)
Mutual labels:  selenium-webdriver
Steward
PHP libraries that makes Selenium WebDriver + PHPUnit functional testing easy and robust
Stars: ✭ 215 (+1435.71%)
Mutual labels:  selenium-webdriver
Scrape Linkedin Selenium
`scrape_linkedin` is a python package that allows you to scrape personal LinkedIn profiles & company pages - turning the data into structured json.
Stars: ✭ 239 (+1607.14%)
Mutual labels:  selenium-webdriver
Ayespy
A performant visual regression testing tool
Stars: ✭ 150 (+971.43%)
Mutual labels:  selenium-webdriver
selenium-appium
selenium-webdriver+appium: A bridge to make selenium-webdriver to drive appium to do native app testing
Stars: ✭ 35 (+150%)
Mutual labels:  selenium-webdriver
Jest Webdriver
Connect Jest tests to Selenium WebDriver
Stars: ✭ 229 (+1535.71%)
Mutual labels:  selenium-webdriver
pdf-crawler
SimFin's open source PDF crawler
Stars: ✭ 100 (+614.29%)
Mutual labels:  selenium-webdriver
Selenium Jupiter
JUnit 5 extension for Selenium WebDriver
Stars: ✭ 185 (+1221.43%)
Mutual labels:  selenium-webdriver
Panther
A browser testing and web crawling library for PHP and Symfony
Stars: ✭ 2,480 (+17614.29%)
Mutual labels:  selenium-webdriver
Lambdium
headless chrome + selenium webdriver in AWS Lambda using the serverless application model
Stars: ✭ 246 (+1657.14%)
Mutual labels:  selenium-webdriver
Selenoid
Selenium Hub successor running browsers within containers. Scalable, immutable, self hosted Selenium-Grid on any platform with single binary.
Stars: ✭ 2,065 (+14650%)
Mutual labels:  selenium-webdriver
SeleniumWebDriverWithCSharp
BDD with Selenium Webdriver and Specflow using C#
Stars: ✭ 22 (+57.14%)
Mutual labels:  selenium-webdriver
Facebook Post Scraper
Facebook Post Scraper 🕵️🖱️
Stars: ✭ 152 (+985.71%)
Mutual labels:  selenium-webdriver
Ocaramba
C# Framework to automate tests using Selenium WebDriver
Stars: ✭ 234 (+1571.43%)
Mutual labels:  selenium-webdriver
SHAFT ENGINE
SHAFT is an MIT licensed test automation engine. Powered by best-in-class frameworks like Selenium WebDriver, Appium & RestAssured it provides a wizard-like syntax to increase productivity, and built-in wrappers to eliminate boilerplate code and to ensure your tests are extra stable and your results are extra reliable.
Stars: ✭ 170 (+1114.29%)
Mutual labels:  selenium-webdriver
QVisual
Tinkoff tool to control quality by visual testing
Stars: ✭ 47 (+235.71%)
Mutual labels:  selenium-webdriver
Instagram-Like-Comment-Bot
📷 An Instagram bot written in Python using Selenium on Google Chrome. It will go through posts in hashtag(s) and like and comment on them.
Stars: ✭ 53 (+278.57%)
Mutual labels:  selenium-webdriver

shale

Shale, a Clojure-backed Selenium hub replacement

Circle CI

Clojars Project

Progress

Shale is a lightweight replacement for a Selenium hub. We've found hubs to be more trouble than they're worth operationally, but we still need some of the management features.

Currently shale lets you get, create, and delete webdriver sessions, and maintains "reservation" and "tag" metadata to make querying against sessions easy.

Nodes can be discovered via the AWS API, a list of URLs, or through a custom INodePool implementation. See the example config for details.

Running

Clone the repo

git clone [email protected]:cardforcoin/shale.git

In development, you can run the service with lein.

lein run
# OR, run it in a REPL
lein repl
> (init)
> (start)
INFO [shale.configurer] Loaded shale config...
{:node-list ["http://localhost:4444/wd/hub" "http://localhost:4443/wd/hub"],
 :node-max-sessions 6,
 :port 5000,
 :webdriver-timeout 3000,
 :start-webdriver-timeout 5000}
INFO [shale.nodes] - Starting the node pool...
INFO [shale.sessions] - Starting session pool...
INFO [shale.core] - Starting Jetty...

To deploy the service, make a jar and run that.

lein uberjar
java -jar target/shale-0.3.0-SNAPSHOT-standalone.jar

Configuration

By default, a config file- config.clj- is expected on the classpath. example-config.clj shows the various options. If you'd like to provide a full path to an alternative config file, set an environment variable CONFIG_FILE with the path, or include the option using another method supported by environ.

All grid nodes should be configured so that they don't attempt to register with a hub (register:false in the node config), and should be accessible via the machine running shale.

Examples

Session creation, selection, and modification uses an S-expression inspired syntax.

curl

Get or create a new session

curl -d '{"require": ["browser_name", "phantomjs"]}' -XPOST \
     http://localhost:5000/sessions/ \
     --header "Content-Type:application/json"
{
  "id": "05e9229d-356b-46a3-beae-f8ab02cea7db",
  "webdriver_id": "bd416414-e80f-4556-9d97-ebcfdc44425f",
  "reserved": false,
  "node": {"url":"http://localhost:5555/wd/hub", "id":"2c28f0f2-e479-4501-a05d-a0991793abd7"},
  "browser_name": "phantomjs",
  "tags": []
}

List all the active sessions

curl http://localhost:5000/sessions/
[{
  "id": "05e9229d-356b-46a3-beae-f8ab02cea7db",
  "webdriver_id": "bd416414-e80f-4556-9d97-ebcfdc44425f",
  "reserved": false,
  "node": {"url":"http://localhost:5555/wd/hub", "id":"2c28f0f2-e479-4501-a05d-a0991793abd7"},
  "browser_name": "phantomjs",
  "tags": []
}]

Create a new session with tags

curl -d '{"create": {"browser_name":"phantomjs", "tags":["walmart"]}}' \
     -XPOST http://localhost:5000/sessions/ \
     --header "Content-Type:application/json"
{
  "id": "05e9229d-356b-46a3-beae-f8ab02cea7db",
  "webdriver_id": "bd416414-e80f-4556-9d97-ebcfdc44425f",
  "reserved": false,
  "node": {"url":"http://localhost:5555/wd/hub", "id":"2c28f0f2-e479-4501-a05d-a0991793abd7"},
  "browser_name": "phantomjs",
  "tags": ["walmart"]
}

Get or create a new reserved session with tags

curl -d '{"require": ["and [["browser_name", "phantomjs"] ["tag", "walmart"]]],
          "modify": [["reserve", true]]}' \
     -XPOST http://localhost:5000/sessions/ \
     --header "Content-Type:application/json"
{
  "id": "05e9229d-356b-46a3-beae-f8ab02cea7db",
  "webdriver_id": "bd416414-e80f-4556-9d97-ebcfdc44425f",
  "reserved": true,
  "node": {"url":"http://localhost:5555/wd/hub", "id":"2c28f0f2-e479-4501-a05d-a0991793abd7"},
  "browser_name": "phantomjs",
  "tags": ["walmart"]
}

Create a session on a particular node

curl -d '{"create": {"browser_name":"phantomjs", "node":{"id": "<node id>"}}}' \
     -XPOST http://localhost:5000/sessions/ \
     --header "Content-Type:application/json"

Create a Chrome session using a proxy (manually)

You can create sessions with custom options, like proxy settings, disabling local storage, or any other settings exposed by Selenium's DesiredCapabilities.

curl -d '{"create": {"browser_name":"chrome", "extra_desired_capabilities": {"chromeOptions": {"args": ["--proxy-server=socks5://<host>:<port>", "--disable-plugins","--disable-local-storage"]}}}' \
     -XPOST http://localhost:5000/sessions/ \
     --header "Content-Type:application/json"

Note, though, that there are better ways to manage session proxies!

Unreserve a session and add a tag

PATCH accepts an array of modifications, including change_tag, reserve, and go_to_url.

curl -d '[["change_tag", {"action": "add", "tag":"walmart"}], ["reserve", true]]' \
     -XPATCH http://localhost:5000/sessions/05e9229d-356b-46a3-beae-f8ab02cea7db \
     --header "Content-Type:application/json"
{
  "id": "05e9229d-356b-46a3-beae-f8ab02cea7db",
  "webdriver_id": "bd416414-e80f-4556-9d97-ebcfdc44425f",
  "reserved": false,
  "node": {"url":"http://localhost:5555/wd/hub", "id":"2c28f0f2-e479-4501-a05d-a0991793abd7"},
  "browser_name": "phantomjs",
  "tags": ["walmart", "logged-in"]
}

Delete a session

Note that this will de-allocate the Selenium driver.

curl -XDELETE http://localhost:5000/sessions/05e9229d-356b-46a3-beae-f8ab02cea7db
true

Delete all sessions

curl -XDELETE http://localhost:5000/sessions/
true

Proxies

Shale also includes its own proxy management that allows proxies to be shared between sessions.

An initial proxy list can be provided in the config.

Add a new proxy

curl -XPOST http://localhost:5000/proxies/ \
     -d '{
            "public_ip": "8.8.8.8",
            "host": "127.0.0.1",
            "port": 1234,
            "type":"socks5"
            "shared":true
         }' \
     --header "Content-Type:application/json"
{
    "id":"f7c64a2c-595d-434c-80f0-15c9751ddcc8",
    "public_ip":"127.0.0.1",
    "host":"128.0.0.1",
    "port":1234,
    "type":"socks5",
    "active":true,
    "shared":true
}

A proxy with "shared": false can only be used by sessions that reference it by ID. Those with "shared": true are candidates for use by other sessions.

The public_ip is an optional attribute to keep track of a proxies public-facing IP. This can be useful if you're testing public sites on the internet, and have an IP whitelist.

Currently, only SOCKS proxies are supported.

List all proxies

curl http://localhost:5000/proxies/
[
    {
        "id":"f7c64a2c-595d-434c-80f0-15c9751ddcc8",
        "public_ip":"8.8.8.8",
        "host":"127.0.0.1",
        "port":1234,
        "type":"socks5",
        "active":true,
        "shared":true
    }
]

Create a Chrome session with a new proxy

curl -d '{"create": {"browser_name":"chrome", "proxy": {"type": "socks5", "host": "<host>", "port":<port>, "shared": true}}}'
     -XPOST http://localhost:5000/sessions/ \
     --header "Content-Type:application/json"

If the proxy hasn't been seen before, it will be recorded as a candidate for use by other sessions. To avoid that behavior, set "shared": false.

Get or create a Chrome session with an existing proxy

curl -d '{"require": ["and" [["browser_name", "chrome"] ["proxy", ["id", "f7c64a2c-595d-434c-80f0-15c9751ddcc8"]]]]}'
     -XPOST http://localhost:5000/sessions/ \
     --header "Content-Type:application/json"

Clojure

The Clojure client returns functional web drivers using clj-webdriver, and includes a macro to make working with drivers easier.

Here's an example of how to get-or-create, reserve, use, and release a driver using the with-webdriver* macro, inspired by the clj-webdriver examples.

;; Log into Github
;;
(use '[shale.client :only [with-driver]])
(use 'clj-webdriver.taxi)
(with-webdriver* {:browser-name :firefox :tags ["github"]}
  (to "https://github.com")
  (click "a[href*='login']")
  (input-text "#login_field" "your_username")
  (-> "#password"
    (input-text "your_password")
    submit))

See the clj-webdriver docs and the client source for more details.

Python

There is also a Python client with its own examples and documentation.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].