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

Getting Started

semperos edited this page Feb 18, 2012 · 6 revisions

Quick Start

Here's an example of logging into Github:

    (use 'clj-webdriver.core)
    (def b (start {:browser :firefox} "https://github.com"))

    ;; Click "Login" link
    (-> b
        (find-element {:text "Login"})
        click)
    
    ;; Input username/email into the "Login or Email" field
    (-> b
        (find-element {:class "text", :name "login"}) ; use multiple attributes
        (input-text "username"))
    
    ;; Input password into the "Password" field
    (-> b
        (find-element {:xpath "//input[@id='password']"}) ; even in "easy" mode, you still
        (input-text "password"))                     ; have :xpath and :css options
    
    ;; Click the "Log in" button"
    (-> b
        (find-element {:tag :input, :value #"Log"}) ; use regular expressions
        click)                                 ; also used optional tag arg, :input