formatting
FossilOrigin-Name: 0b5f81d8cdae951e2e6d3102f008d4344dbbf6c5c355804098ddf2b1eaae2b1e
This commit is contained in:
parent
b06ec4f507
commit
b956247c18
4 changed files with 35 additions and 37 deletions
14
Makefile
14
Makefile
|
@ -1,7 +1,7 @@
|
||||||
|
|
||||||
# Tangling and weaving
|
# Tangling and weaving
|
||||||
|
|
||||||
webdriver.scm webdriver-impl.scm webdriver.html webdriver.egg webdriver.release-info tests/run.scm: webdriver.org vendor/htmlize.el
|
webdriver.scm webdriver-impl.scm webdriver.md webdriver.egg webdriver.release-info tests/run.scm: webdriver.org vendor/htmlize.el
|
||||||
emacs --batch \
|
emacs --batch \
|
||||||
--load "~/.config/emacs/early-init.el" \
|
--load "~/.config/emacs/early-init.el" \
|
||||||
--load "vendor/htmlize.el" \
|
--load "vendor/htmlize.el" \
|
||||||
|
@ -12,12 +12,12 @@ webdriver.scm webdriver-impl.scm webdriver.html webdriver.egg webdriver.release-
|
||||||
--eval "(require 'htmlize)" \
|
--eval "(require 'htmlize)" \
|
||||||
--file "${.ALLSRC:[1]}" \
|
--file "${.ALLSRC:[1]}" \
|
||||||
-f org-babel-tangle \
|
-f org-babel-tangle \
|
||||||
-f org-html-export-to-html
|
-f org-md-export-to-markdown
|
||||||
mv "${.ALLSRC:[1]:R}.html" "${.ALLSRC:[1]:R}.html.old"
|
# mv "${.ALLSRC:[1]:R}.html" "${.ALLSRC:[1]:R}.html.old"
|
||||||
echo "<div class='fossil-doc' data-title='`cat "${.ALLSRC:[1]:R}.html.old" | grep 'class="title"' | sed -e 's/^.*">//' | sed -e 's/<\/h1>//'`'>" > "${.ALLSRC:[1]:R}.html"
|
# echo "<div class='fossil-doc' data-title='`cat "${.ALLSRC:[1]:R}.html.old" | grep 'class="title"' | sed -e 's/^.*">//' | sed -e 's/<\/h1>//'`'>" > "${.ALLSRC:[1]:R}.html"
|
||||||
cat "${.ALLSRC:[1]:R}.html.old" | sed -e '1,11d' | head -n -2 >> "${.ALLSRC:[1]:R}.html"
|
# cat "${.ALLSRC:[1]:R}.html.old" | sed -e '1,11d' | head -n -2 >> "${.ALLSRC:[1]:R}.html"
|
||||||
echo "</div>" >> "${.ALLSRC:[1]:R}.html"
|
# echo "</div>" >> "${.ALLSRC:[1]:R}.html"
|
||||||
rm "${.ALLSRC:[1]:R}.html.old"
|
# rm "${.ALLSRC:[1]:R}.html.old"
|
||||||
|
|
||||||
vendor/htmlize.el:
|
vendor/htmlize.el:
|
||||||
mkdir -p vendor
|
mkdir -p vendor
|
||||||
|
|
|
@ -25,6 +25,7 @@
|
||||||
;; #+name: wd-session-test
|
;; #+name: wd-session-test
|
||||||
|
|
||||||
;; [[file:../webdriver.org::wd-session-test][wd-session-test]]
|
;; [[file:../webdriver.org::wd-session-test][wd-session-test]]
|
||||||
|
<<prep-geckodriver-test>>
|
||||||
(test-group "session"
|
(test-group "session"
|
||||||
(let ((browser (make-WebDriver <Gecko>)))
|
(let ((browser (make-WebDriver <Gecko>)))
|
||||||
(test "Initial state" #f (slot-value browser 'session-id))
|
(test "Initial state" #f (slot-value browser 'session-id))
|
||||||
|
@ -38,6 +39,8 @@
|
||||||
;; #+name: wd-url-test
|
;; #+name: wd-url-test
|
||||||
|
|
||||||
;; [[file:../webdriver.org::wd-url-test][wd-url-test]]
|
;; [[file:../webdriver.org::wd-url-test][wd-url-test]]
|
||||||
|
<<prep-geckodriver-test>>
|
||||||
|
<<wd-url>>
|
||||||
(test-group "url"
|
(test-group "url"
|
||||||
(let ((browser (make-WebDriver <Gecko>)))
|
(let ((browser (make-WebDriver <Gecko>)))
|
||||||
(test "Initial state" #f (slot-value browser 'session-id))
|
(test "Initial state" #f (slot-value browser 'session-id))
|
||||||
|
|
|
@ -16,9 +16,7 @@
|
||||||
)
|
)
|
||||||
;; Dependencies:4 ends here
|
;; Dependencies:4 ends here
|
||||||
|
|
||||||
|
;; Error Conditions
|
||||||
|
|
||||||
;; * Error Conditions
|
|
||||||
|
|
||||||
;; #+name: wd-exception
|
;; #+name: wd-exception
|
||||||
|
|
||||||
|
@ -97,9 +95,7 @@
|
||||||
)
|
)
|
||||||
;; conditions ends here
|
;; conditions ends here
|
||||||
|
|
||||||
|
;; WebDriver
|
||||||
|
|
||||||
;; * WebDriver
|
|
||||||
|
|
||||||
;; The core element of the library is the ~<WebDriver>~ class and its subclasses. The class has the following fields:
|
;; The core element of the library is the ~<WebDriver>~ class and its subclasses. The class has the following fields:
|
||||||
|
|
||||||
|
@ -156,9 +152,7 @@
|
||||||
instance))
|
instance))
|
||||||
;; webdriver-init ends here
|
;; webdriver-init ends here
|
||||||
|
|
||||||
|
;; Geckodriver
|
||||||
|
|
||||||
;; ** Geckodriver
|
|
||||||
|
|
||||||
;; The Geckodriver is used to control Firefox.
|
;; The Geckodriver is used to control Firefox.
|
||||||
|
|
||||||
|
@ -201,11 +195,7 @@
|
||||||
(alist-ref/default result 'value result))
|
(alist-ref/default result 'value result))
|
||||||
;; geckodriver-postprocess ends here
|
;; geckodriver-postprocess ends here
|
||||||
|
|
||||||
|
;; Communication
|
||||||
|
|
||||||
;; * WebDriver API
|
|
||||||
|
|
||||||
;; ** Communication
|
|
||||||
|
|
||||||
;; Data is sent to the API via a central class method. For convenience, there is a ~send-with-session~ variant that automatically adds the session id.
|
;; Data is sent to the API via a central class method. For convenience, there is a ~send-with-session~ variant that automatically adds the session id.
|
||||||
|
|
||||||
|
@ -229,9 +219,7 @@
|
||||||
(send instance data (string-append "session/" (slot-value instance 'session-id) "/" uri) method))
|
(send instance data (string-append "session/" (slot-value instance 'session-id) "/" uri) method))
|
||||||
;; wd-send ends here
|
;; wd-send ends here
|
||||||
|
|
||||||
|
;; Session management
|
||||||
|
|
||||||
;; ** Session management
|
|
||||||
|
|
||||||
;; Session management is very simple. There is just one method to initialize a new session. Everything else is handled automatically.
|
;; Session management is very simple. There is just one method to initialize a new session. Everything else is handled automatically.
|
||||||
|
|
||||||
|
@ -254,18 +242,7 @@
|
||||||
(set! (slot-value instance 'session-id) #f))
|
(set! (slot-value instance 'session-id) #f))
|
||||||
;; wd-term-session ends here
|
;; wd-term-session ends here
|
||||||
|
|
||||||
|
;; API Access Methods
|
||||||
|
|
||||||
;; #+RESULTS: wd-session-test
|
|
||||||
;; : -- testing session -----------------------------------------------------------
|
|
||||||
;; : Initial state ........................................................ [ PASS]
|
|
||||||
;; : Session id check ..................................................... [ PASS]
|
|
||||||
;; : Session id after termination ......................................... [ PASS]
|
|
||||||
;; : 3 tests completed in 3.788 seconds.
|
|
||||||
;; : 3 out of 3 (100%) tests passed.
|
|
||||||
;; : -- done testing session ------------------------------------------------------
|
|
||||||
|
|
||||||
;; ** API Access Methods
|
|
||||||
|
|
||||||
;; #+name: wd-url
|
;; #+name: wd-url
|
||||||
|
|
||||||
|
@ -338,7 +315,7 @@
|
||||||
(send-with-session instance `((script . ,script) (args . ,args)) "execute/sync" 'POST))
|
(send-with-session instance `((script . ,script) (args . ,args)) "execute/sync" 'POST))
|
||||||
;; API Access Methods:12 ends here
|
;; API Access Methods:12 ends here
|
||||||
|
|
||||||
|
;; Timeouts
|
||||||
|
|
||||||
;; The following timeouts are defined:
|
;; The following timeouts are defined:
|
||||||
|
|
||||||
|
@ -361,6 +338,9 @@
|
||||||
(implicit . ,(slot-value instance 'implicit))))
|
(implicit . ,(slot-value instance 'implicit))))
|
||||||
;; Timeouts:2 ends here
|
;; Timeouts:2 ends here
|
||||||
|
|
||||||
|
;; Setting and getting timeouts
|
||||||
|
|
||||||
|
|
||||||
;; [[file:webdriver.org::*Setting and getting timeouts][Setting and getting timeouts:1]]
|
;; [[file:webdriver.org::*Setting and getting timeouts][Setting and getting timeouts:1]]
|
||||||
(define-method (set-timeouts (instance <WebDriver>) (timeouts <WDTimeouts>))
|
(define-method (set-timeouts (instance <WebDriver>) (timeouts <WDTimeouts>))
|
||||||
(send-with-session instance (extract timeouts) "timeouts" 'POST))
|
(send-with-session instance (extract timeouts) "timeouts" 'POST))
|
||||||
|
@ -373,6 +353,9 @@
|
||||||
'implicit (alist-ref result 'implicit))))
|
'implicit (alist-ref result 'implicit))))
|
||||||
;; Setting and getting timeouts:1 ends here
|
;; Setting and getting timeouts:1 ends here
|
||||||
|
|
||||||
|
;; Element Class
|
||||||
|
|
||||||
|
|
||||||
;; [[file:webdriver.org::*Element Class][Element Class:1]]
|
;; [[file:webdriver.org::*Element Class][Element Class:1]]
|
||||||
(define-class <WDElement> ()
|
(define-class <WDElement> ()
|
||||||
((driver #f)
|
((driver #f)
|
||||||
|
@ -386,6 +369,9 @@
|
||||||
method))
|
method))
|
||||||
;; Element Class:2 ends here
|
;; Element Class:2 ends here
|
||||||
|
|
||||||
|
;; Location Strategies
|
||||||
|
|
||||||
|
|
||||||
;; [[file:webdriver.org::*Location Strategies][Location Strategies:1]]
|
;; [[file:webdriver.org::*Location Strategies][Location Strategies:1]]
|
||||||
(define css-selector "css selector")
|
(define css-selector "css selector")
|
||||||
(define link-text "link text")
|
(define link-text "link text")
|
||||||
|
@ -394,6 +380,9 @@
|
||||||
(define xpath "xpath")
|
(define xpath "xpath")
|
||||||
;; Location Strategies:1 ends here
|
;; Location Strategies:1 ends here
|
||||||
|
|
||||||
|
;; Accessor Methods
|
||||||
|
|
||||||
|
|
||||||
;; [[file:webdriver.org::*Accessor Methods][Accessor Methods:1]]
|
;; [[file:webdriver.org::*Accessor Methods][Accessor Methods:1]]
|
||||||
(define-method (find-element (instance <WebDriver>) strategy selector)
|
(define-method (find-element (instance <WebDriver>) strategy selector)
|
||||||
(let ((result (send-with-session instance `((using . ,strategy) (value . ,selector)) "element" 'POST)))
|
(let ((result (send-with-session instance `((using . ,strategy) (value . ,selector)) "element" 'POST)))
|
||||||
|
@ -424,6 +413,9 @@
|
||||||
result)))
|
result)))
|
||||||
;; Accessor Methods:4 ends here
|
;; Accessor Methods:4 ends here
|
||||||
|
|
||||||
|
;; Working with Elements
|
||||||
|
|
||||||
|
|
||||||
;; [[file:webdriver.org::*Working with Elements][Working with Elements:1]]
|
;; [[file:webdriver.org::*Working with Elements][Working with Elements:1]]
|
||||||
(define-method (attribute (instance <WDElement>) attribute)
|
(define-method (attribute (instance <WDElement>) attribute)
|
||||||
(let ((result (send-with-session instance #f
|
(let ((result (send-with-session instance #f
|
||||||
|
|
|
@ -1,3 +1,6 @@
|
||||||
|
;; About This Egg
|
||||||
|
|
||||||
|
|
||||||
;; [[file:webdriver.org::*About This Egg][About This Egg:1]]
|
;; [[file:webdriver.org::*About This Egg][About This Egg:1]]
|
||||||
;; -*- scheme -*-
|
;; -*- scheme -*-
|
||||||
((author "Daniel Ziltener")
|
((author "Daniel Ziltener")
|
||||||
|
|
Loading…
Reference in a new issue