Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/agilecreativity/etuk

Selenium wrapper to automate commonly used apis.
https://github.com/agilecreativity/etuk

automation clojure clojure-wrapper selenium-webdriver

Last synced: about 1 month ago
JSON representation

Selenium wrapper to automate commonly used apis.

Awesome Lists containing this project

README

        

** etuk - Simple driver of Selenium via Webica

#+ATTR_HTML: title="Clojars"
[[https://clojars.org/etuk][file:https://img.shields.io/clojars/v/etuk.svg]]

#+ATTR_HTML: title="Jarkeeper"
[[https://jarkeeper.com/agilecreativity/etuk][file:https://jarkeeper.com/agilecreativity/etuk/status.svg]]

Clojure Selenium driver via Webica wrapper in Clojure.

*** Basic Installation

For this to work just open your command line and
**** You will need to make sure that =chromedriver= is installed in =/usr/local/bin=
**** For Firefox drive you will need =geckodriver= and must be installed to =/usr/local/bin=

#+BEGIN_SRC sh
cd ~/projects/

# Clone the webica project locally
git clone [email protected]:tmarble/webica.git

# Build the library for use locally
cd ~/projects/webica && boot build-jar

# Clone the patched version of webica project
git clone [email protected]:agilecreativity/etuk.git

# Then build it to your local repository
cd ~/projects/etuk && boot build-jar

# For example of the api try =src/etuk/examples/*.clj= for more detail
boot download-selenium

# To login to Github - need to setup sample configuration (edn file)
# Adjust to your local path e.g. ~/Dropbox/login/github.edn
# with content like the following
# { :username "your-github-user"
# :password "your-password"
# :url "https://github.com/login" }
boot login-github
#+END_SRC

*** Basic Usage

- Excerpted from [[src/etuk/core.clj][core.clj]]

#+BEGIN_SRC clojure
(ns etuk.core
(:require [etuk.browser-utils :refer [start-chrome-session start-firefox-session] :as but]
[etuk.core-wait :refer :all :as cwt]
[etuk.core-navigator :refer :all :as cnv]
[webica.remote-web-driver :as browser]
[webica.expected-conditions :as ec]
[webica.web-element :as element])
(:gen-class))

(defn download-selenium-jars
[]
(start-chrome-session)
(browser/get "http://www.seleniumhq.org/")

;; Click the big Download link
(cnv/navigate :wdriver (cwt/get-instance)
:wfn ec/presence-of-element-located
:type :css-selector
:expr "#sidebar > div.downloadBox > a"
:act-name element/click
:act-arg nil)

;; Then click on the download Selenium Java driver 3.3.0 version link
(cnv/navigate :wdriver (cwt/get-instance)
:wfn ec/presence-of-element-located
:type :css-selector
:expr "#mainContent > table:nth-child(13) > tbody > tr:nth-child(1) > td:nth-child(4) > a"
:act-name element/click
:act-arg nil))

(defn -main [& args]
(try
(download-selenium-jars)
(catch Exception e
(.printStackTrace e)
(println (str "Unexpected errors: " (.getMessage e))))))
#+END_SRC

*** Development

**** Leiningen/Boot

#+BEGIN_SRC clojure
[etuk "0.1.0"]
#+END_SRC

**** Gradle

#+BEGIN_SRC groovy
compile "etuk:etuk:0.1.0"
#+END_SRC

**** Maven

#+BEGIN_SRC xml

etuk
etuk
0.1.0

#+END_SRC

** Useful Links

- [[http://selenium-python.readthedocs.io/api.html#desired-capabilities][desired-capabilities]]
- [[http://selenium-python.readthedocs.io/api.html#module-selenium.webdriver.support.expected_conditions][module-selenium.webdriver.support.expected_conditions]]

** Warning:

This is early stage of development so things will changes as this project evolve.

** License

Copyright © 2017 agilecreativity

Distributed under the Eclipse Public License either version 1.0 or (at
your option) any later version.