Skip to content
This repository was archived by the owner on Nov 9, 2017. It is now read-only.

Low level Wrappers

semperos edited this page Feb 19, 2012 · 1 revision

The following is an example of logging into Github, leveraging the lowest-level functions that provide the thinnest layer over WebDriver's API:

    ;;; The Harder, Lower-Level Way ;;;
    
    (def b (start {:browser :firefox} "https://github.com"))

    ;; Click "Login" link
    (->> "//ul[@class='nav logged_out']/li/a[text()='Login']"
         by-xpath
         (find-element-by b)
         click)
    
    ;; Input username/email into the "Login or Email" field
    (input-text (->> "login_field"
                      by-id
                      (find-element-by b))
                "username")
    
    ;; Input password into the "Password" field
    (input-text (->>  "password"
                      (by-attr= :name)
                      (find-element-by b))
                "password")
    
    ;; Click the "Log in" button
    (->> "body.logged_out div#login.login_form label.submit_btn input"
         by-css-selector
         (find-element-by b)
         click)
Clone this wiki locally