Egg exports, fixed tests
FossilOrigin-Name: 9fda0ddb1e6272d88a0677b7596b1fa888cb62fb1394872cd572e26dbdcce4c2
This commit is contained in:
parent
5e04cbc144
commit
1439bd4aa6
7 changed files with 239 additions and 136 deletions
6
Makefile
6
Makefile
|
@ -23,6 +23,12 @@ vendor/htmlize.el:
|
||||||
mkdir -p vendor
|
mkdir -p vendor
|
||||||
wget https://raw.githubusercontent.com/hniksic/emacs-htmlize/dd27bc3f26efd728f2b1f01f9e4ac4f61f2ffbf9/htmlize.el -O vendor/htmlize.el
|
wget https://raw.githubusercontent.com/hniksic/emacs-htmlize/dd27bc3f26efd728f2b1f01f9e4ac4f61f2ffbf9/htmlize.el -O vendor/htmlize.el
|
||||||
|
|
||||||
|
salmonella: webdriver.scm
|
||||||
|
rm -rf report
|
||||||
|
rm -f webdriver*.so
|
||||||
|
salmonella --keep-repo --repo-dir=./petri-dish; \
|
||||||
|
salmonella-html-report ./salmonella.log report
|
||||||
|
|
||||||
# Extension Rules
|
# Extension Rules
|
||||||
.scm.so:
|
.scm.so:
|
||||||
csc5 -R r7rs -X r7rs -sJ ${.IMPSRC}
|
csc5 -R r7rs -X r7rs -sJ ${.IMPSRC}
|
||||||
|
|
|
@ -22,29 +22,9 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
;; #+name: prep-geckodriver-test
|
|
||||||
|
|
||||||
;; [[file:../webdriver.org::prep-geckodriver-test][prep-geckodriver-test]]
|
|
||||||
<<prep-test>>
|
|
||||||
<<wd-exception>>
|
|
||||||
<<conditions>>
|
|
||||||
<<webdriver-class>>
|
|
||||||
<<webdriver-basics>>
|
|
||||||
<<webdriver-init>>
|
|
||||||
<<geckodriver-basic>>
|
|
||||||
<<geckodriver-capabilities>>
|
|
||||||
<<geckodriver-postprocess>>
|
|
||||||
<<wd-send>>
|
|
||||||
<<wd-init-session>>
|
|
||||||
<<wd-term-session>>
|
|
||||||
;; prep-geckodriver-test ends here
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
;; #+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 (new-WebDriver <Gecko>)))
|
(let ((browser (new-WebDriver <Gecko>)))
|
||||||
(test "Initial state" #f (slot-value browser 'session-id))
|
(test "Initial state" #f (slot-value browser 'session-id))
|
||||||
|
@ -58,8 +38,6 @@
|
||||||
;; #+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 (new-WebDriver <Gecko>)))
|
(let ((browser (new-WebDriver <Gecko>)))
|
||||||
(test "Initial state" #f (slot-value browser 'session-id))
|
(test "Initial state" #f (slot-value browser 'session-id))
|
||||||
|
|
|
@ -16,7 +16,9 @@
|
||||||
)
|
)
|
||||||
;; Dependencies:4 ends here
|
;; Dependencies:4 ends here
|
||||||
|
|
||||||
;; Error Conditions
|
|
||||||
|
|
||||||
|
;; * Error Conditions
|
||||||
|
|
||||||
;; #+name: wd-exception
|
;; #+name: wd-exception
|
||||||
|
|
||||||
|
@ -95,7 +97,9 @@
|
||||||
)
|
)
|
||||||
;; 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:
|
||||||
|
|
||||||
|
@ -152,7 +156,9 @@
|
||||||
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.
|
||||||
|
|
||||||
|
@ -195,7 +201,11 @@
|
||||||
(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.
|
||||||
|
|
||||||
|
@ -219,7 +229,9 @@
|
||||||
(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.
|
||||||
|
|
||||||
|
@ -242,7 +254,18 @@
|
||||||
(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
|
||||||
|
|
||||||
|
@ -315,7 +338,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:
|
||||||
|
|
||||||
|
@ -338,9 +361,6 @@
|
||||||
(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))
|
||||||
|
@ -353,9 +373,6 @@
|
||||||
'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)
|
||||||
|
@ -369,9 +386,6 @@
|
||||||
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")
|
||||||
|
@ -380,14 +394,10 @@
|
||||||
(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)))
|
||||||
(make <WDElement> 'driver instance 'element (car (alist-values result)))
|
(make <WDElement> 'driver instance 'element (car (alist-values result)))))
|
||||||
element))
|
|
||||||
;; Accessor Methods:1 ends here
|
;; Accessor Methods:1 ends here
|
||||||
|
|
||||||
;; [[file:webdriver.org::*Accessor Methods][Accessor Methods:2]]
|
;; [[file:webdriver.org::*Accessor Methods][Accessor Methods:2]]
|
||||||
|
@ -402,8 +412,7 @@
|
||||||
;; [[file:webdriver.org::*Accessor Methods][Accessor Methods:3]]
|
;; [[file:webdriver.org::*Accessor Methods][Accessor Methods:3]]
|
||||||
(define-method (find-element (instance <WDElement>) strategy selector)
|
(define-method (find-element (instance <WDElement>) 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)))
|
||||||
(make <WDElement> 'driver (slot-value instance 'driver) 'element (car (alist-values result)))
|
(make <WDElement> 'driver (slot-value instance 'driver) 'element (car (alist-values result)))))
|
||||||
element))
|
|
||||||
;; Accessor Methods:3 ends here
|
;; Accessor Methods:3 ends here
|
||||||
|
|
||||||
;; [[file:webdriver.org::*Accessor Methods][Accessor Methods:4]]
|
;; [[file:webdriver.org::*Accessor Methods][Accessor Methods:4]]
|
||||||
|
@ -415,9 +424,6 @@
|
||||||
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,6 +1,3 @@
|
||||||
;; 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")
|
||||||
|
|
154
webdriver.html
154
webdriver.html
|
@ -191,38 +191,38 @@
|
||||||
<h2>Table of Contents</h2>
|
<h2>Table of Contents</h2>
|
||||||
<div id="text-table-of-contents" role="doc-toc">
|
<div id="text-table-of-contents" role="doc-toc">
|
||||||
<ul>
|
<ul>
|
||||||
<li><a href="#orgcf15ed5">1. Dependencies</a></li>
|
<li><a href="#org938cf63">1. Dependencies</a></li>
|
||||||
<li><a href="#org9654a3f">2. Error Conditions</a></li>
|
<li><a href="#orgc4797fa">2. Error Conditions</a></li>
|
||||||
<li><a href="#org0c6a48e">3. WebDriver</a>
|
<li><a href="#org1cee5b7">3. WebDriver</a>
|
||||||
<ul>
|
<ul>
|
||||||
<li><a href="#orgf711da9">3.1. Geckodriver</a></li>
|
<li><a href="#org61500b5">3.1. Geckodriver</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
<li><a href="#org90a0d04">4. WebDriver API</a>
|
<li><a href="#orga31e530">4. WebDriver API</a>
|
||||||
<ul>
|
<ul>
|
||||||
<li><a href="#org0af98b8">4.1. Communication</a></li>
|
<li><a href="#orgf8aeb42">4.1. Communication</a></li>
|
||||||
<li><a href="#orgc8415a8">4.2. Session management</a></li>
|
<li><a href="#orgf926bca">4.2. Session management</a></li>
|
||||||
<li><a href="#orgf324492">4.3. API Access Methods</a></li>
|
<li><a href="#org642d83b">4.3. API Access Methods</a></li>
|
||||||
<li><a href="#org7b9187a">4.4. Timeouts</a>
|
<li><a href="#org3cdc212">4.4. Timeouts</a>
|
||||||
<ul>
|
<ul>
|
||||||
<li><a href="#orgbd9c6f9">4.4.1. Setting and getting timeouts</a></li>
|
<li><a href="#orgddf0877">4.4.1. Setting and getting timeouts</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
<li><a href="#orgfb95f06">4.5. Elements</a>
|
<li><a href="#orgc957f3c">4.5. Elements</a>
|
||||||
<ul>
|
<ul>
|
||||||
<li><a href="#orgb69c4d2">4.5.1. Element Class</a></li>
|
<li><a href="#org996c1c1">4.5.1. Element Class</a></li>
|
||||||
<li><a href="#org898fb82">4.5.2. Finding Elements</a></li>
|
<li><a href="#orge0c1248">4.5.2. Finding Elements</a></li>
|
||||||
<li><a href="#org2951da3">4.5.3. Working with Elements</a></li>
|
<li><a href="#org644471e">4.5.3. Working with Elements</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
<li><a href="#orgc2f2dc5">5. About This Egg</a>
|
<li><a href="#org9d71b9d">5. About This Egg</a>
|
||||||
<ul>
|
<ul>
|
||||||
<li><a href="#orgdd96e8f">5.1. Source</a></li>
|
<li><a href="#orgcc06501">5.1. Source</a></li>
|
||||||
<li><a href="#orga5a4244">5.2. Author</a></li>
|
<li><a href="#org4b7b8df">5.2. Author</a></li>
|
||||||
<li><a href="#org10db57e">5.3. Version History</a></li>
|
<li><a href="#orga3964f6">5.3. Version History</a></li>
|
||||||
<li><a href="#org62e841d">5.4. License</a></li>
|
<li><a href="#org13b2a0e">5.4. License</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
@ -230,10 +230,10 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div id="outline-container-orgcf15ed5" class="outline-2">
|
<div id="outline-container-org938cf63" class="outline-2">
|
||||||
<h2 id="orgcf15ed5"><span class="section-number-2">1.</span> Dependencies</h2>
|
<h2 id="org938cf63"><span class="section-number-2">1.</span> Dependencies</h2>
|
||||||
<div class="outline-text-2" id="text-1">
|
<div class="outline-text-2" id="text-1">
|
||||||
<table id="orgade00f9" border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">
|
<table id="org7e9d4af" border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">
|
||||||
|
|
||||||
|
|
||||||
<colgroup>
|
<colgroup>
|
||||||
|
@ -297,11 +297,11 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="outline-container-org9654a3f" class="outline-2">
|
<div id="outline-container-orgc4797fa" class="outline-2">
|
||||||
<h2 id="org9654a3f"><span class="section-number-2">2.</span> Error Conditions</h2>
|
<h2 id="orgc4797fa"><span class="section-number-2">2.</span> Error Conditions</h2>
|
||||||
<div class="outline-text-2" id="text-2">
|
<div class="outline-text-2" id="text-2">
|
||||||
<div class="org-src-container">
|
<div class="org-src-container">
|
||||||
<pre class="src src-scheme" id="org93a940f">(define-condition-type &wd-exception &error wd-exception?
|
<pre class="src src-scheme" id="org8fb96e4">(define-condition-type &wd-exception &error wd-exception?
|
||||||
(stacktrace wd-stacktrace)
|
(stacktrace wd-stacktrace)
|
||||||
(data wd-data))
|
(data wd-data))
|
||||||
</pre>
|
</pre>
|
||||||
|
@ -311,7 +311,7 @@
|
||||||
Every API error code (key "error" in the returned JSON data) gets its own condition type, prefixed by <code>&</code>. They all inherit from <code>&wd-exception</code>.
|
Every API error code (key "error" in the returned JSON data) gets its own condition type, prefixed by <code>&</code>. They all inherit from <code>&wd-exception</code>.
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<table id="org1401727" border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">
|
<table id="orgbec1a33" border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">
|
||||||
|
|
||||||
|
|
||||||
<colgroup>
|
<colgroup>
|
||||||
|
@ -470,15 +470,15 @@ Every API error code (key "error" in the returned JSON data) gets its own condit
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="outline-container-org0c6a48e" class="outline-2">
|
<div id="outline-container-org1cee5b7" class="outline-2">
|
||||||
<h2 id="org0c6a48e"><span class="section-number-2">3.</span> WebDriver</h2>
|
<h2 id="org1cee5b7"><span class="section-number-2">3.</span> WebDriver</h2>
|
||||||
<div class="outline-text-2" id="text-3">
|
<div class="outline-text-2" id="text-3">
|
||||||
<p>
|
<p>
|
||||||
The core element of the library is the <code><WebDriver></code> class and its subclasses. The class has the following fields:
|
The core element of the library is the <code><WebDriver></code> class and its subclasses. The class has the following fields:
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<div class="org-src-container">
|
<div class="org-src-container">
|
||||||
<pre class="src src-scheme" id="orgc21fbf1">(<span style="font-weight: bold;">define-class</span> <span style="font-weight: bold; text-decoration: underline;"><WebDriver></span> ()
|
<pre class="src src-scheme" id="org80ac06c">(<span style="font-weight: bold;">define-class</span> <span style="font-weight: bold; text-decoration: underline;"><WebDriver></span> ()
|
||||||
((browser #f)
|
((browser #f)
|
||||||
(active? #f)
|
(active? #f)
|
||||||
(browser-pid #f)
|
(browser-pid #f)
|
||||||
|
@ -495,7 +495,7 @@ The parent class provides a handful of methods, but does not implement all of th
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<div class="org-src-container">
|
<div class="org-src-container">
|
||||||
<pre class="src src-scheme" id="org23c2abe">(<span style="font-weight: bold;">define-method</span> (<span style="font-weight: bold;">launch</span> <span style="font-weight: bold;">#:after</span> (instance <span style="font-weight: bold; text-decoration: underline;"><WebDriver></span>) options)
|
<pre class="src src-scheme" id="org4a70fdb">(<span style="font-weight: bold;">define-method</span> (<span style="font-weight: bold;">launch</span> <span style="font-weight: bold;">#:after</span> (instance <span style="font-weight: bold; text-decoration: underline;"><WebDriver></span>) options)
|
||||||
(set-finalizer! instance (<span style="font-weight: bold;">lambda</span> (obj)
|
(set-finalizer! instance (<span style="font-weight: bold;">lambda</span> (obj)
|
||||||
(<span style="font-weight: bold;">when</span> (slot-value instance 'active?)
|
(<span style="font-weight: bold;">when</span> (slot-value instance 'active?)
|
||||||
(terminate instance)))))
|
(terminate instance)))))
|
||||||
|
@ -519,7 +519,7 @@ Main initialization is done by calling the <code>new-WebDriver</code> procedure
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<div class="org-src-container">
|
<div class="org-src-container">
|
||||||
<pre class="src src-scheme" id="org08997aa">(<span style="font-weight: bold;">define</span> (<span style="font-weight: bold;">new-WebDriver</span> browser #!optional options)
|
<pre class="src src-scheme" id="org7bb2c72">(<span style="font-weight: bold;">define</span> (<span style="font-weight: bold;">new-WebDriver</span> browser #!optional options)
|
||||||
(<span style="font-weight: bold;">let</span> ((instance (make browser)))
|
(<span style="font-weight: bold;">let</span> ((instance (make browser)))
|
||||||
(launch instance options)
|
(launch instance options)
|
||||||
(sleep 1)
|
(sleep 1)
|
||||||
|
@ -528,15 +528,15 @@ Main initialization is done by calling the <code>new-WebDriver</code> procedure
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="outline-container-orgf711da9" class="outline-3">
|
<div id="outline-container-org61500b5" class="outline-3">
|
||||||
<h3 id="orgf711da9"><span class="section-number-3">3.1.</span> Geckodriver</h3>
|
<h3 id="org61500b5"><span class="section-number-3">3.1.</span> Geckodriver</h3>
|
||||||
<div class="outline-text-3" id="text-3-1">
|
<div class="outline-text-3" id="text-3-1">
|
||||||
<p>
|
<p>
|
||||||
The Geckodriver is used to control Firefox.
|
The Geckodriver is used to control Firefox.
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<div class="org-src-container">
|
<div class="org-src-container">
|
||||||
<pre class="src src-scheme" id="org5224a0d">(<span style="font-weight: bold;">define-class</span> <span style="font-weight: bold; text-decoration: underline;"><Gecko></span> (<span style="font-weight: bold; text-decoration: underline;"><WebDriver></span>)
|
<pre class="src src-scheme" id="orgd065300">(<span style="font-weight: bold;">define-class</span> <span style="font-weight: bold; text-decoration: underline;"><Gecko></span> (<span style="font-weight: bold; text-decoration: underline;"><WebDriver></span>)
|
||||||
((browser <span style="font-weight: bold;">#:firefox</span>)
|
((browser <span style="font-weight: bold;">#:firefox</span>)
|
||||||
(server <span style="font-style: italic;">"127.0.0.1"</span>)
|
(server <span style="font-style: italic;">"127.0.0.1"</span>)
|
||||||
(port 4444)))
|
(port 4444)))
|
||||||
|
@ -555,7 +555,7 @@ For more information on capabilities, see <a href="https://developer.mozilla.org
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<div class="org-src-container">
|
<div class="org-src-container">
|
||||||
<pre class="src src-scheme" id="org024c29a">(<span style="font-weight: bold;">define-method</span> (<span style="font-weight: bold;">construct-capabilities</span> (instance <span style="font-weight: bold; text-decoration: underline;"><Gecko></span>))
|
<pre class="src src-scheme" id="org4fda735">(<span style="font-weight: bold;">define-method</span> (<span style="font-weight: bold;">construct-capabilities</span> (instance <span style="font-weight: bold; text-decoration: underline;"><Gecko></span>))
|
||||||
(<span style="font-weight: bold;">let</span> ((caps (<span style="font-weight: bold;">or</span> (slot-value instance 'capabilities) (list))))
|
(<span style="font-weight: bold;">let</span> ((caps (<span style="font-weight: bold;">or</span> (slot-value instance 'capabilities) (list))))
|
||||||
`((capabilities . ,caps))))
|
`((capabilities . ,caps))))
|
||||||
</pre>
|
</pre>
|
||||||
|
@ -566,7 +566,7 @@ Sometimes, Geckodriver returns the results of a command in a JSON object with th
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<div class="org-src-container">
|
<div class="org-src-container">
|
||||||
<pre class="src src-scheme" id="org2cc8f63">(<span style="font-weight: bold;">define-method</span> (<span style="font-weight: bold;">postprocess-result</span> (instance <span style="font-weight: bold; text-decoration: underline;"><Gecko></span>) result)
|
<pre class="src src-scheme" id="orgdf4e656">(<span style="font-weight: bold;">define-method</span> (<span style="font-weight: bold;">postprocess-result</span> (instance <span style="font-weight: bold; text-decoration: underline;"><Gecko></span>) result)
|
||||||
(alist-ref/default result 'value result))
|
(alist-ref/default result 'value result))
|
||||||
</pre>
|
</pre>
|
||||||
</div>
|
</div>
|
||||||
|
@ -574,19 +574,19 @@ Sometimes, Geckodriver returns the results of a command in a JSON object with th
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="outline-container-org90a0d04" class="outline-2">
|
<div id="outline-container-orga31e530" class="outline-2">
|
||||||
<h2 id="org90a0d04"><span class="section-number-2">4.</span> WebDriver API</h2>
|
<h2 id="orga31e530"><span class="section-number-2">4.</span> WebDriver API</h2>
|
||||||
<div class="outline-text-2" id="text-4">
|
<div class="outline-text-2" id="text-4">
|
||||||
</div>
|
</div>
|
||||||
<div id="outline-container-org0af98b8" class="outline-3">
|
<div id="outline-container-orgf8aeb42" class="outline-3">
|
||||||
<h3 id="org0af98b8"><span class="section-number-3">4.1.</span> Communication</h3>
|
<h3 id="orgf8aeb42"><span class="section-number-3">4.1.</span> Communication</h3>
|
||||||
<div class="outline-text-3" id="text-4-1">
|
<div class="outline-text-3" id="text-4-1">
|
||||||
<p>
|
<p>
|
||||||
Data is sent to the API via a central class method. For convenience, there is a <code>send-with-session</code> variant that automatically adds the session id.
|
Data is sent to the API via a central class method. For convenience, there is a <code>send-with-session</code> variant that automatically adds the session id.
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<div class="org-src-container">
|
<div class="org-src-container">
|
||||||
<pre class="src src-scheme" id="org9aa4391">(<span style="font-weight: bold;">define-method</span> (<span style="font-weight: bold;">send</span> (instance <span style="font-weight: bold; text-decoration: underline;"><WebDriver></span>) data uri method)
|
<pre class="src src-scheme" id="org7145be6">(<span style="font-weight: bold;">define-method</span> (<span style="font-weight: bold;">send</span> (instance <span style="font-weight: bold; text-decoration: underline;"><WebDriver></span>) data uri method)
|
||||||
(<span style="font-weight: bold;">let*</span> ((remote (string-append <span style="font-style: italic;">"http://"</span> (slot-value instance 'server) <span style="font-style: italic;">":"</span> (->string (slot-value instance 'port)) <span style="font-style: italic;">"/"</span>))
|
(<span style="font-weight: bold;">let*</span> ((remote (string-append <span style="font-style: italic;">"http://"</span> (slot-value instance 'server) <span style="font-style: italic;">":"</span> (->string (slot-value instance 'port)) <span style="font-style: italic;">"/"</span>))
|
||||||
(result (postprocess-result instance
|
(result (postprocess-result instance
|
||||||
(with-input-from-request
|
(with-input-from-request
|
||||||
|
@ -606,22 +606,22 @@ Data is sent to the API via a central class method. For convenience, there is a
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="outline-container-orgc8415a8" class="outline-3">
|
<div id="outline-container-orgf926bca" class="outline-3">
|
||||||
<h3 id="orgc8415a8"><span class="section-number-3">4.2.</span> Session management</h3>
|
<h3 id="orgf926bca"><span class="section-number-3">4.2.</span> Session management</h3>
|
||||||
<div class="outline-text-3" id="text-4-2">
|
<div class="outline-text-3" id="text-4-2">
|
||||||
<p>
|
<p>
|
||||||
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.
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<div class="org-src-container">
|
<div class="org-src-container">
|
||||||
<pre class="src src-scheme" id="orga2b91e8">(<span style="font-weight: bold;">define-method</span> (<span style="font-weight: bold;">initialize-session</span> (instance <span style="font-weight: bold; text-decoration: underline;"><WebDriver></span>))
|
<pre class="src src-scheme" id="org1b6f47e">(<span style="font-weight: bold;">define-method</span> (<span style="font-weight: bold;">initialize-session</span> (instance <span style="font-weight: bold; text-decoration: underline;"><WebDriver></span>))
|
||||||
(<span style="font-weight: bold;">let</span> ((result (send instance (construct-capabilities instance) <span style="font-style: italic;">"session"</span> 'POST)))
|
(<span style="font-weight: bold;">let</span> ((result (send instance (construct-capabilities instance) <span style="font-style: italic;">"session"</span> 'POST)))
|
||||||
(set! (slot-value instance 'session-id) (alist-ref result 'sessionId))))
|
(set! (slot-value instance 'session-id) (alist-ref result 'sessionId))))
|
||||||
</pre>
|
</pre>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="org-src-container">
|
<div class="org-src-container">
|
||||||
<pre class="src src-scheme" id="orged636bc">(<span style="font-weight: bold;">define-method</span> (<span style="font-weight: bold;">terminate-session</span> (instance <span style="font-weight: bold; text-decoration: underline;"><WebDriver></span>))
|
<pre class="src src-scheme" id="org32425a6">(<span style="font-weight: bold;">define-method</span> (<span style="font-weight: bold;">terminate-session</span> (instance <span style="font-weight: bold; text-decoration: underline;"><WebDriver></span>))
|
||||||
(<span style="font-weight: bold;">when</span> (slot-value instance 'session-id)
|
(<span style="font-weight: bold;">when</span> (slot-value instance 'session-id)
|
||||||
(send instance #f (string-append <span style="font-style: italic;">"session/"</span> (slot-value instance 'session-id)) 'DELETE))
|
(send instance #f (string-append <span style="font-style: italic;">"session/"</span> (slot-value instance 'session-id)) 'DELETE))
|
||||||
(set! (slot-value instance 'session-id) #f))
|
(set! (slot-value instance 'session-id) #f))
|
||||||
|
@ -640,11 +640,11 @@ Session id after termination ......................................... [ PASS]
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="outline-container-orgf324492" class="outline-3">
|
<div id="outline-container-org642d83b" class="outline-3">
|
||||||
<h3 id="orgf324492"><span class="section-number-3">4.3.</span> API Access Methods</h3>
|
<h3 id="org642d83b"><span class="section-number-3">4.3.</span> API Access Methods</h3>
|
||||||
<div class="outline-text-3" id="text-4-3">
|
<div class="outline-text-3" id="text-4-3">
|
||||||
<div class="org-src-container">
|
<div class="org-src-container">
|
||||||
<pre class="src src-scheme" id="orgc9e0623">(<span style="font-weight: bold;">define-method</span> (<span style="font-weight: bold;">set-url</span> (instance <span style="font-weight: bold; text-decoration: underline;"><WebDriver></span>) url)
|
<pre class="src src-scheme" id="orgdb03c5d">(<span style="font-weight: bold;">define-method</span> (<span style="font-weight: bold;">set-url</span> (instance <span style="font-weight: bold; text-decoration: underline;"><WebDriver></span>) url)
|
||||||
(send-with-session instance `((url . ,url)) <span style="font-style: italic;">"url"</span> 'POST))
|
(send-with-session instance `((url . ,url)) <span style="font-style: italic;">"url"</span> 'POST))
|
||||||
|
|
||||||
(<span style="font-weight: bold;">define-method</span> (<span style="font-weight: bold;">url</span> (instance <span style="font-weight: bold; text-decoration: underline;"><WebDriver></span>))
|
(<span style="font-weight: bold;">define-method</span> (<span style="font-weight: bold;">url</span> (instance <span style="font-weight: bold; text-decoration: underline;"><WebDriver></span>))
|
||||||
|
@ -724,8 +724,8 @@ Navigating to the first website ...................................... [ PASS]
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="outline-container-org7b9187a" class="outline-3">
|
<div id="outline-container-org3cdc212" class="outline-3">
|
||||||
<h3 id="org7b9187a"><span class="section-number-3">4.4.</span> Timeouts</h3>
|
<h3 id="org3cdc212"><span class="section-number-3">4.4.</span> Timeouts</h3>
|
||||||
<div class="outline-text-3" id="text-4-4">
|
<div class="outline-text-3" id="text-4-4">
|
||||||
<p>
|
<p>
|
||||||
The following timeouts are defined:
|
The following timeouts are defined:
|
||||||
|
@ -754,8 +754,8 @@ The following timeouts are defined:
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="outline-container-orgbd9c6f9" class="outline-4">
|
<div id="outline-container-orgddf0877" class="outline-4">
|
||||||
<h4 id="orgbd9c6f9"><span class="section-number-4">4.4.1.</span> Setting and getting timeouts</h4>
|
<h4 id="orgddf0877"><span class="section-number-4">4.4.1.</span> Setting and getting timeouts</h4>
|
||||||
<div class="outline-text-4" id="text-4-4-1">
|
<div class="outline-text-4" id="text-4-4-1">
|
||||||
<div class="org-src-container">
|
<div class="org-src-container">
|
||||||
<pre class="src src-scheme">(<span style="font-weight: bold;">define-method</span> (<span style="font-weight: bold;">set-timeouts</span> (instance <span style="font-weight: bold; text-decoration: underline;"><WebDriver></span>) (timeouts <span style="font-weight: bold; text-decoration: underline;"><WDTimeouts></span>))
|
<pre class="src src-scheme">(<span style="font-weight: bold;">define-method</span> (<span style="font-weight: bold;">set-timeouts</span> (instance <span style="font-weight: bold; text-decoration: underline;"><WebDriver></span>) (timeouts <span style="font-weight: bold; text-decoration: underline;"><WDTimeouts></span>))
|
||||||
|
@ -773,12 +773,12 @@ The following timeouts are defined:
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="outline-container-orgfb95f06" class="outline-3">
|
<div id="outline-container-orgc957f3c" class="outline-3">
|
||||||
<h3 id="orgfb95f06"><span class="section-number-3">4.5.</span> Elements</h3>
|
<h3 id="orgc957f3c"><span class="section-number-3">4.5.</span> Elements</h3>
|
||||||
<div class="outline-text-3" id="text-4-5">
|
<div class="outline-text-3" id="text-4-5">
|
||||||
</div>
|
</div>
|
||||||
<div id="outline-container-orgb69c4d2" class="outline-4">
|
<div id="outline-container-org996c1c1" class="outline-4">
|
||||||
<h4 id="orgb69c4d2"><span class="section-number-4">4.5.1.</span> Element Class</h4>
|
<h4 id="org996c1c1"><span class="section-number-4">4.5.1.</span> Element Class</h4>
|
||||||
<div class="outline-text-4" id="text-4-5-1">
|
<div class="outline-text-4" id="text-4-5-1">
|
||||||
<div class="org-src-container">
|
<div class="org-src-container">
|
||||||
<pre class="src src-scheme">(<span style="font-weight: bold;">define-class</span> <span style="font-weight: bold; text-decoration: underline;"><WDElement></span> ()
|
<pre class="src src-scheme">(<span style="font-weight: bold;">define-class</span> <span style="font-weight: bold; text-decoration: underline;"><WDElement></span> ()
|
||||||
|
@ -797,12 +797,12 @@ The following timeouts are defined:
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="outline-container-org898fb82" class="outline-4">
|
<div id="outline-container-orge0c1248" class="outline-4">
|
||||||
<h4 id="org898fb82"><span class="section-number-4">4.5.2.</span> Finding Elements</h4>
|
<h4 id="orge0c1248"><span class="section-number-4">4.5.2.</span> Finding Elements</h4>
|
||||||
<div class="outline-text-4" id="text-4-5-2">
|
<div class="outline-text-4" id="text-4-5-2">
|
||||||
</div>
|
</div>
|
||||||
<ol class="org-ol">
|
<ol class="org-ol">
|
||||||
<li><a id="org83c0f36"></a>Location Strategies<br />
|
<li><a id="org8e90cc4"></a>Location Strategies<br />
|
||||||
<div class="outline-text-5" id="text-4-5-2-1">
|
<div class="outline-text-5" id="text-4-5-2-1">
|
||||||
<div class="org-src-container">
|
<div class="org-src-container">
|
||||||
<pre class="src src-scheme">(<span style="font-weight: bold;">define</span> <span style="font-weight: bold;">css-selector</span> <span style="font-style: italic;">"css selector"</span>)
|
<pre class="src src-scheme">(<span style="font-weight: bold;">define</span> <span style="font-weight: bold;">css-selector</span> <span style="font-style: italic;">"css selector"</span>)
|
||||||
|
@ -815,13 +815,12 @@ The following timeouts are defined:
|
||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
<li><a id="org4fe962b"></a>Accessor Methods<br />
|
<li><a id="org259e671"></a>Accessor Methods<br />
|
||||||
<div class="outline-text-5" id="text-4-5-2-2">
|
<div class="outline-text-5" id="text-4-5-2-2">
|
||||||
<div class="org-src-container">
|
<div class="org-src-container">
|
||||||
<pre class="src src-scheme">(<span style="font-weight: bold;">define-method</span> (<span style="font-weight: bold;">find-element</span> (instance <span style="font-weight: bold; text-decoration: underline;"><WebDriver></span>) strategy selector)
|
<pre class="src src-scheme">(<span style="font-weight: bold;">define-method</span> (<span style="font-weight: bold;">find-element</span> (instance <span style="font-weight: bold; text-decoration: underline;"><WebDriver></span>) strategy selector)
|
||||||
(<span style="font-weight: bold;">let</span> ((result (send-with-session instance `((using . ,strategy) (value . ,selector)) <span style="font-style: italic;">"element"</span> 'POST)))
|
(<span style="font-weight: bold;">let</span> ((result (send-with-session instance `((using . ,strategy) (value . ,selector)) <span style="font-style: italic;">"element"</span> 'POST)))
|
||||||
(make <span style="font-weight: bold; text-decoration: underline;"><WDElement></span> 'driver instance 'element (car (alist-values result)))
|
(make <span style="font-weight: bold; text-decoration: underline;"><WDElement></span> 'driver instance 'element (car (alist-values result)))))
|
||||||
element))
|
|
||||||
</pre>
|
</pre>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -838,8 +837,7 @@ The following timeouts are defined:
|
||||||
<div class="org-src-container">
|
<div class="org-src-container">
|
||||||
<pre class="src src-scheme">(<span style="font-weight: bold;">define-method</span> (<span style="font-weight: bold;">find-element</span> (instance <span style="font-weight: bold; text-decoration: underline;"><WDElement></span>) strategy selector)
|
<pre class="src src-scheme">(<span style="font-weight: bold;">define-method</span> (<span style="font-weight: bold;">find-element</span> (instance <span style="font-weight: bold; text-decoration: underline;"><WDElement></span>) strategy selector)
|
||||||
(<span style="font-weight: bold;">let</span> ((result (send-with-session instance `((using . ,strategy) (value . ,selector)) <span style="font-style: italic;">"element"</span> 'POST)))
|
(<span style="font-weight: bold;">let</span> ((result (send-with-session instance `((using . ,strategy) (value . ,selector)) <span style="font-style: italic;">"element"</span> 'POST)))
|
||||||
(make <span style="font-weight: bold; text-decoration: underline;"><WDElement></span> 'driver (slot-value instance 'driver) 'element (car (alist-values result)))
|
(make <span style="font-weight: bold; text-decoration: underline;"><WDElement></span> 'driver (slot-value instance 'driver) 'element (car (alist-values result)))))
|
||||||
element))
|
|
||||||
</pre>
|
</pre>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -857,8 +855,8 @@ The following timeouts are defined:
|
||||||
</ol>
|
</ol>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="outline-container-org2951da3" class="outline-4">
|
<div id="outline-container-org644471e" class="outline-4">
|
||||||
<h4 id="org2951da3"><span class="section-number-4">4.5.3.</span> Working with Elements</h4>
|
<h4 id="org644471e"><span class="section-number-4">4.5.3.</span> Working with Elements</h4>
|
||||||
<div class="outline-text-4" id="text-4-5-3">
|
<div class="outline-text-4" id="text-4-5-3">
|
||||||
<div class="org-src-container">
|
<div class="org-src-container">
|
||||||
<pre class="src src-scheme">(<span style="font-weight: bold;">define-method</span> (<span style="font-weight: bold;">attribute</span> (instance <span style="font-weight: bold; text-decoration: underline;"><WDElement></span>) attribute)
|
<pre class="src src-scheme">(<span style="font-weight: bold;">define-method</span> (<span style="font-weight: bold;">attribute</span> (instance <span style="font-weight: bold; text-decoration: underline;"><WDElement></span>) attribute)
|
||||||
|
@ -947,12 +945,12 @@ The following timeouts are defined:
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="outline-container-orgc2f2dc5" class="outline-2">
|
<div id="outline-container-org9d71b9d" class="outline-2">
|
||||||
<h2 id="orgc2f2dc5"><span class="section-number-2">5.</span> About This Egg</h2>
|
<h2 id="org9d71b9d"><span class="section-number-2">5.</span> About This Egg</h2>
|
||||||
<div class="outline-text-2" id="text-5">
|
<div class="outline-text-2" id="text-5">
|
||||||
</div>
|
</div>
|
||||||
<div id="outline-container-orgdd96e8f" class="outline-3">
|
<div id="outline-container-orgcc06501" class="outline-3">
|
||||||
<h3 id="orgdd96e8f"><span class="section-number-3">5.1.</span> Source</h3>
|
<h3 id="orgcc06501"><span class="section-number-3">5.1.</span> Source</h3>
|
||||||
<div class="outline-text-3" id="text-5-1">
|
<div class="outline-text-3" id="text-5-1">
|
||||||
<p>
|
<p>
|
||||||
The source is available at <a href="https://fossil.lyrion.ch/chicken-webdriver">https://fossil.lyrion.ch/chicken-webdriver</a>.
|
The source is available at <a href="https://fossil.lyrion.ch/chicken-webdriver">https://fossil.lyrion.ch/chicken-webdriver</a>.
|
||||||
|
@ -960,8 +958,8 @@ The source is available at <a href="https://fossil.lyrion.ch/chicken-webdriver">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="outline-container-orga5a4244" class="outline-3">
|
<div id="outline-container-org4b7b8df" class="outline-3">
|
||||||
<h3 id="orga5a4244"><span class="section-number-3">5.2.</span> Author</h3>
|
<h3 id="org4b7b8df"><span class="section-number-3">5.2.</span> Author</h3>
|
||||||
<div class="outline-text-3" id="text-5-2">
|
<div class="outline-text-3" id="text-5-2">
|
||||||
<p>
|
<p>
|
||||||
Daniel Ziltener
|
Daniel Ziltener
|
||||||
|
@ -969,10 +967,10 @@ Daniel Ziltener
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="outline-container-org10db57e" class="outline-3">
|
<div id="outline-container-orga3964f6" class="outline-3">
|
||||||
<h3 id="org10db57e"><span class="section-number-3">5.3.</span> Version History</h3>
|
<h3 id="orga3964f6"><span class="section-number-3">5.3.</span> Version History</h3>
|
||||||
<div class="outline-text-3" id="text-5-3">
|
<div class="outline-text-3" id="text-5-3">
|
||||||
<table id="org49cf4e2" border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">
|
<table id="orgde56041" border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">
|
||||||
|
|
||||||
|
|
||||||
<colgroup>
|
<colgroup>
|
||||||
|
@ -990,8 +988,8 @@ Daniel Ziltener
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="outline-container-org62e841d" class="outline-3">
|
<div id="outline-container-org13b2a0e" class="outline-3">
|
||||||
<h3 id="org62e841d"><span class="section-number-3">5.4.</span> License</h3>
|
<h3 id="org13b2a0e"><span class="section-number-3">5.4.</span> License</h3>
|
||||||
<div class="outline-text-3" id="text-5-4">
|
<div class="outline-text-3" id="text-5-4">
|
||||||
<div class="org-src-container">
|
<div class="org-src-container">
|
||||||
<pre class="src src-fundamental">Copyright (C) 2023 Daniel Ziltener
|
<pre class="src src-fundamental">Copyright (C) 2023 Daniel Ziltener
|
||||||
|
@ -1027,7 +1025,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
</div>
|
</div>
|
||||||
<div id="postamble" class="status">
|
<div id="postamble" class="status">
|
||||||
<p class="author">Author: Daniel Ziltener</p>
|
<p class="author">Author: Daniel Ziltener</p>
|
||||||
<p class="date">Created: 2023-04-13 Do 17:01</p>
|
<p class="date">Created: 2023-04-13 Do 17:38</p>
|
||||||
<p class="validation"><a href="https://validator.w3.org/check?uri=referer">Validate</a></p>
|
<p class="validation"><a href="https://validator.w3.org/check?uri=referer">Validate</a></p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -60,7 +60,49 @@
|
||||||
(import r7rs)
|
(import r7rs)
|
||||||
(define-library (webdriver)
|
(define-library (webdriver)
|
||||||
(import (scheme base))
|
(import (scheme base))
|
||||||
(export <WDElement>)
|
(export <WebDriver>
|
||||||
|
<Gecko>
|
||||||
|
new-WebDriver
|
||||||
|
terminate
|
||||||
|
initialize-session
|
||||||
|
terminate-session
|
||||||
|
set-url
|
||||||
|
url
|
||||||
|
back
|
||||||
|
forward
|
||||||
|
refresh
|
||||||
|
title
|
||||||
|
status
|
||||||
|
source
|
||||||
|
screenshot
|
||||||
|
print-page
|
||||||
|
execute-async
|
||||||
|
execute-sync
|
||||||
|
<WDTimeouts>
|
||||||
|
set-timeouts
|
||||||
|
timeouts
|
||||||
|
<WDElement>
|
||||||
|
find-element
|
||||||
|
find-elements
|
||||||
|
attribute
|
||||||
|
property
|
||||||
|
clear
|
||||||
|
click
|
||||||
|
computed-label
|
||||||
|
computed-role
|
||||||
|
enabled?
|
||||||
|
selected?
|
||||||
|
name
|
||||||
|
rect
|
||||||
|
screenshot
|
||||||
|
text
|
||||||
|
set-value
|
||||||
|
&wd-exception
|
||||||
|
wd-exception?
|
||||||
|
wd-stacktrace
|
||||||
|
wd-data
|
||||||
|
<<export-conditions()>>
|
||||||
|
)
|
||||||
(include "webdriver-impl.scm"))
|
(include "webdriver-impl.scm"))
|
||||||
#+end_src
|
#+end_src
|
||||||
|
|
||||||
|
@ -121,6 +163,15 @@ Every API error code (key "error" in the returned JSON data) gets its own condit
|
||||||
| unknown-method | unknown method |
|
| unknown-method | unknown method |
|
||||||
| unsupported-operation | unsupported operation |
|
| unsupported-operation | unsupported operation |
|
||||||
|
|
||||||
|
#+name: export-conditions
|
||||||
|
#+begin_src emacs-lisp :var src=error-code-table :exports none :results raw
|
||||||
|
(mapconcat
|
||||||
|
(lambda (row)
|
||||||
|
(let ((replace `((?n . ,(cl-first row)))))
|
||||||
|
(format-spec "&%n %n?" replace)))
|
||||||
|
src "\n")
|
||||||
|
#+end_src
|
||||||
|
|
||||||
#+name: define-conditions
|
#+name: define-conditions
|
||||||
#+begin_src emacs-lisp :var src=error-code-table :exports none :results raw
|
#+begin_src emacs-lisp :var src=error-code-table :exports none :results raw
|
||||||
(mapconcat
|
(mapconcat
|
||||||
|
@ -241,7 +292,7 @@ Sometimes, Geckodriver returns the results of a command in a JSON object with th
|
||||||
#+end_src
|
#+end_src
|
||||||
|
|
||||||
#+name: prep-geckodriver-test
|
#+name: prep-geckodriver-test
|
||||||
#+begin_src scheme :tangle tests/run.scm :noweb strip-tangle :exports none :post test-post(input=*this*) :results output
|
#+begin_src scheme :noweb strip-tangle :exports none :post test-post(input=*this*) :results output
|
||||||
<<prep-test>>
|
<<prep-test>>
|
||||||
<<wd-exception>>
|
<<wd-exception>>
|
||||||
<<conditions>>
|
<<conditions>>
|
||||||
|
@ -473,8 +524,7 @@ The following timeouts are defined:
|
||||||
#+begin_src scheme :tangle webdriver-impl.scm
|
#+begin_src scheme :tangle webdriver-impl.scm
|
||||||
(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)))
|
||||||
(make <WDElement> 'driver instance 'element (car (alist-values result)))
|
(make <WDElement> 'driver instance 'element (car (alist-values result)))))
|
||||||
element))
|
|
||||||
#+end_src
|
#+end_src
|
||||||
|
|
||||||
#+begin_src scheme :tangle webdriver-impl.scm
|
#+begin_src scheme :tangle webdriver-impl.scm
|
||||||
|
@ -489,8 +539,7 @@ The following timeouts are defined:
|
||||||
#+begin_src scheme :tangle webdriver-impl.scm
|
#+begin_src scheme :tangle webdriver-impl.scm
|
||||||
(define-method (find-element (instance <WDElement>) strategy selector)
|
(define-method (find-element (instance <WDElement>) 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)))
|
||||||
(make <WDElement> 'driver (slot-value instance 'driver) 'element (car (alist-values result)))
|
(make <WDElement> 'driver (slot-value instance 'driver) 'element (car (alist-values result)))))
|
||||||
element))
|
|
||||||
#+end_src
|
#+end_src
|
||||||
|
|
||||||
#+begin_src scheme :tangle webdriver-impl.scm
|
#+begin_src scheme :tangle webdriver-impl.scm
|
||||||
|
|
|
@ -2,6 +2,75 @@
|
||||||
(import r7rs)
|
(import r7rs)
|
||||||
(define-library (webdriver)
|
(define-library (webdriver)
|
||||||
(import (scheme base))
|
(import (scheme base))
|
||||||
(export <WDElement>)
|
(export <WebDriver>
|
||||||
|
<Gecko>
|
||||||
|
new-WebDriver
|
||||||
|
terminate
|
||||||
|
initialize-session
|
||||||
|
terminate-session
|
||||||
|
set-url
|
||||||
|
url
|
||||||
|
back
|
||||||
|
forward
|
||||||
|
refresh
|
||||||
|
title
|
||||||
|
status
|
||||||
|
source
|
||||||
|
screenshot
|
||||||
|
print-page
|
||||||
|
execute-async
|
||||||
|
execute-sync
|
||||||
|
<WDTimeouts>
|
||||||
|
set-timeouts
|
||||||
|
timeouts
|
||||||
|
<WDElement>
|
||||||
|
find-element
|
||||||
|
find-elements
|
||||||
|
attribute
|
||||||
|
property
|
||||||
|
clear
|
||||||
|
click
|
||||||
|
computed-label
|
||||||
|
computed-role
|
||||||
|
enabled?
|
||||||
|
selected?
|
||||||
|
name
|
||||||
|
rect
|
||||||
|
screenshot
|
||||||
|
text
|
||||||
|
set-value
|
||||||
|
&wd-exception
|
||||||
|
wd-exception?
|
||||||
|
wd-stacktrace
|
||||||
|
wd-data
|
||||||
|
&detached-shadow-root detached-shadow-root?
|
||||||
|
&element-click-intercepted element-click-intercepted?
|
||||||
|
&element-not-interactable element-not-interactable?
|
||||||
|
&insecure-certificate insecure-certificate?
|
||||||
|
&invalid-argument invalid-argument?
|
||||||
|
&invalid-cookie-domain invalid-cookie-domain?
|
||||||
|
&invalid-element-state invalid-element-state?
|
||||||
|
&invalid-selector invalid-selector?
|
||||||
|
&invalid-session-id invalid-session-id?
|
||||||
|
&javascript-error javascript-error?
|
||||||
|
&move-target-out-of-bounds move-target-out-of-bounds?
|
||||||
|
&no-such-alert no-such-alert?
|
||||||
|
&no-such-cookie no-such-cookie?
|
||||||
|
&no-such-element no-such-element?
|
||||||
|
&no-such-frame no-such-frame?
|
||||||
|
&no-such-shadow-root no-such-shadow-root?
|
||||||
|
&no-such-window no-such-window?
|
||||||
|
&script-timeout script-timeout?
|
||||||
|
&session-not-created session-not-created?
|
||||||
|
&stale-element-reference stale-element-reference?
|
||||||
|
&timeout timeout?
|
||||||
|
&unable-to-capture-screen unable-to-capture-screen?
|
||||||
|
&unable-to-set-cookie unable-to-set-cookie?
|
||||||
|
&unexpected-alert-open unexpected-alert-open?
|
||||||
|
&unknown-command unknown-command?
|
||||||
|
&unknown-error unknown-error?
|
||||||
|
&unknown-method unknown-method?
|
||||||
|
&unsupported-operation unsupported-operation?
|
||||||
|
)
|
||||||
(include "webdriver-impl.scm"))
|
(include "webdriver-impl.scm"))
|
||||||
;; Dependencies:3 ends here
|
;; Dependencies:3 ends here
|
||||||
|
|
Loading…
Reference in a new issue