Skip to content

agilecreativity/etuk

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

etuk - Simple driver of Selenium via Webica

https://img.shields.io/clojars/v/etuk.svg

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

cd ~/projects/

# Clone the webica project locally
git clone git@github.com:tmarble/webica.git

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

# Clone the patched version of webica project
git clone git@github.com: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

Basic Usage

(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))))))

Development

Leiningen/Boot

[etuk "0.1.0"]

Gradle

compile "etuk:etuk:0.1.0"

Maven

<dependency>
  <groupId>etuk</groupId>
  <artifactId>etuk</artifactId>
  <version>0.1.0</version>
</dependency>

Useful Links

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.

Releases

No releases published

Packages

No packages published