/[cl-selenium]/cl-selenium/selenium.lisp
ViewVC logotype

Contents of /cl-selenium/selenium.lisp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.5 - (show annotations)
Wed Jul 2 03:33:12 2008 UTC (5 years, 9 months ago) by mkennedy
Branch: MAIN
CVS Tags: HEAD
Changes since 1.4: +10 -0 lines
Add convenience method with-selenium-session.
Update driver URL to be Selenium RC default.
1
2 (in-package #:selenium)
3
4 (defmacro define-iedoc (pathname)
5 (let ((functions (parse-iedoc pathname)))
6 `(progn
7 ,@(mapcar #'convert-function functions)
8 ,@(mapcar (lambda (fn)
9 `(export (convert-function-name ,(iedoc-function-name fn)) 'selenium))
10 functions))))
11
12 (define-iedoc
13 #.(merge-pathnames #p"iedoc-0.8.3-1879.xml"
14 *compile-file-pathname*))
15
16 (defun do-get-new-browser-session (browser url)
17 "Create a session by using the the given browser and initial URL."
18 (execute *selenium-driver-url*
19 (marshall-request "getNewBrowserSession" browser url)
20 'string))
21
22 (defun do-test-complete (&optional (session *selenium-session*))
23 "Destroy session, closing the browser."
24 (execute *selenium-driver-url*
25 (cons `("sessionId" . ,session)
26 (marshall-request "testComplete"))))
27
28 (defmacro with-selenium-session ((var browser url) &body body)
29 "Evaluate BODY within a Selenium RC session specified by VAR.
30 Once the body is evaluated, the test complete command is sent which
31 closes the session and browser."
32 `(let ((,var (do-get-new-browser-session ,browser ,url)))
33 (unwind-protect
34 (progn
35 ,@body)
36 (when ,var
37 (do-test-complete ,var)))))

  ViewVC Help
Powered by ViewVC 1.1.5