Skip to content

Instantly share code, notes, and snippets.

@ponkore
Created March 12, 2012 13:27
Show Gist options
  • Save ponkore/2021925 to your computer and use it in GitHub Desktop.
Save ponkore/2021925 to your computer and use it in GitHub Desktop.
clj-webdriver tiny example
(ns clj-selenium-test.core
(:use [clj-webdriver.taxi]))
(defn auto-login []
"http://www.walk-21.com に自動ログインする。REPL にて
user=> (use 'clj-selenium-test.core)
user=> (auto-login)
"
;; top 画面を表示
(set-driver! {:browser :firefox} "http://www.walk-21.com/")
(click (find-element {:tag :img, :name "Image8"})) ; ここで画面遷移
;; login 画面
(input-text (find-element {:tag :input, :name "LOGIN_ID"}) "<login id>")
(input-text (find-element {:tag :input, :name "PASSWORD"}) "<password>")
(click (find-element {:tag :img, :src "img/btn_login.gif"})) ; ここで画面遷移
;; ログイン直後の状態となる。
;; (take-screenshot :file "/Users/Masao/Desktop/a.png") ; スクリーンショットを取る
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment