First release
FossilOrigin-Name: bd39977c82cb9f2e943b2944ad4443e12748b7f854bb2de2c2d27ee99cd4fc01
This commit is contained in:
parent
244029a0c8
commit
68c4194793
7 changed files with 362 additions and 270 deletions
7
Makefile
7
Makefile
|
@ -1,8 +1,9 @@
|
||||||
|
|
||||||
# Tangling and weaving
|
# Tangling and weaving
|
||||||
|
|
||||||
webdriver.scm webdriver-impl.scm webdriver.html webdriver.egg webdriver.release-info tests/run.scm: webdriver.org
|
webdriver.scm webdriver-impl.scm webdriver.html webdriver.egg webdriver.release-info tests/run.scm: webdriver.org vendor/htmlize.el
|
||||||
emacs --batch \
|
emacs --batch \
|
||||||
|
--load "~/.config/emacs/early-init.el" \
|
||||||
--load "vendor/htmlize.el" \
|
--load "vendor/htmlize.el" \
|
||||||
--eval "(setq enable-local-variables :all)" \
|
--eval "(setq enable-local-variables :all)" \
|
||||||
--eval "(setq org-confirm-babel-evaluate nil)" \
|
--eval "(setq org-confirm-babel-evaluate nil)" \
|
||||||
|
@ -18,6 +19,10 @@ webdriver.scm webdriver-impl.scm webdriver.html webdriver.egg webdriver.release-
|
||||||
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:
|
||||||
|
mkdir -p vendor
|
||||||
|
wget https://raw.githubusercontent.com/hniksic/emacs-htmlize/dd27bc3f26efd728f2b1f01f9e4ac4f61f2ffbf9/htmlize.el -O vendor/htmlize.el
|
||||||
|
|
||||||
# Extension Rules
|
# Extension Rules
|
||||||
.scm.so:
|
.scm.so:
|
||||||
csc5 -R r7rs -X r7rs -sJ ${.IMPSRC}
|
csc5 -R r7rs -X r7rs -sJ ${.IMPSRC}
|
||||||
|
|
|
@ -25,7 +25,18 @@
|
||||||
;; #+name: prep-geckodriver-test
|
;; #+name: prep-geckodriver-test
|
||||||
|
|
||||||
;; [[file:../webdriver.org::prep-geckodriver-test][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
|
;; prep-geckodriver-test ends here
|
||||||
|
|
||||||
|
|
||||||
|
@ -33,6 +44,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 (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))
|
||||||
|
@ -46,6 +58,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 (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))
|
||||||
|
@ -55,3 +69,7 @@
|
||||||
(url browser)))
|
(url browser)))
|
||||||
(terminate browser)))
|
(terminate browser)))
|
||||||
;; wd-url-test ends here
|
;; wd-url-test ends here
|
||||||
|
|
||||||
|
;; [[file:../webdriver.org::*About This Egg][About This Egg:2]]
|
||||||
|
(test-exit)
|
||||||
|
;; About This Egg:2 ends here
|
||||||
|
|
|
@ -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)))
|
||||||
|
@ -426,6 +415,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")
|
||||||
|
|
542
webdriver.html
542
webdriver.html
|
@ -1,16 +1,4 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<div class='fossil-doc' data-title='Webdriver implementation in Chicken Scheme'>
|
||||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
|
||||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
|
||||||
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
|
|
||||||
<head>
|
|
||||||
<!-- 2023-04-13 Do 16:13 -->
|
|
||||||
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
||||||
<title>Webdriver implementation in Chicken Scheme</title>
|
|
||||||
<meta name="author" content="Daniel Ziltener" />
|
|
||||||
<meta name="generator" content="Org Mode" />
|
|
||||||
<style>
|
|
||||||
#content { max-width: 60em; margin: auto; }
|
|
||||||
.title { text-align: center;
|
.title { text-align: center;
|
||||||
margin-bottom: .2em; }
|
margin-bottom: .2em; }
|
||||||
.subtitle { text-align: center;
|
.subtitle { text-align: center;
|
||||||
|
@ -201,41 +189,49 @@
|
||||||
<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="#org4399fba">1. Dependencies</a></li>
|
<li><a href="#orgff39d75">1. Dependencies</a></li>
|
||||||
<li><a href="#org686fad8">2. Error Conditions</a></li>
|
<li><a href="#org4651c2d">2. Error Conditions</a></li>
|
||||||
<li><a href="#orgb911463">3. WebDriver</a>
|
<li><a href="#org6193099">3. WebDriver</a>
|
||||||
<ul>
|
<ul>
|
||||||
<li><a href="#org3d13a0c">3.1. Geckodriver</a></li>
|
<li><a href="#org4f8bad8">3.1. Geckodriver</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
<li><a href="#orgf472d01">4. WebDriver API</a>
|
<li><a href="#org4680eae">4. WebDriver API</a>
|
||||||
<ul>
|
<ul>
|
||||||
<li><a href="#org5685400">4.1. Communication</a></li>
|
<li><a href="#orgb60d0eb">4.1. Communication</a></li>
|
||||||
<li><a href="#orgd3b1c20">4.2. Session management</a></li>
|
<li><a href="#org2a85680">4.2. Session management</a></li>
|
||||||
<li><a href="#orgca687e8">4.3. API Access Methods</a></li>
|
<li><a href="#org50c43d3">4.3. API Access Methods</a></li>
|
||||||
<li><a href="#org8175c38">4.4. Timeouts</a>
|
<li><a href="#org970cd9c">4.4. Timeouts</a>
|
||||||
<ul>
|
<ul>
|
||||||
<li><a href="#org2be29cc">4.4.1. Setting and getting timeouts</a></li>
|
<li><a href="#orgc089ded">4.4.1. Setting and getting timeouts</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
<li><a href="#org0b96887">4.5. Elements</a>
|
<li><a href="#org8473447">4.5. Elements</a>
|
||||||
<ul>
|
<ul>
|
||||||
<li><a href="#org3abeb2f">4.5.1. Element Class</a></li>
|
<li><a href="#org870ddb2">4.5.1. Element Class</a></li>
|
||||||
<li><a href="#orgf5ba942">4.5.2. Finding Elements</a></li>
|
<li><a href="#org3abcade">4.5.2. Finding Elements</a></li>
|
||||||
<li><a href="#org25c6507">4.5.3. Working with Elements</a></li>
|
<li><a href="#org1ee7ac0">4.5.3. Working with Elements</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
|
<li><a href="#org86b4a66">5. About This Egg</a>
|
||||||
|
<ul>
|
||||||
|
<li><a href="#orgac72f6e">5.1. Source</a></li>
|
||||||
|
<li><a href="#orgd19a870">5.2. Author</a></li>
|
||||||
|
<li><a href="#orgc04d23c">5.3. Version History</a></li>
|
||||||
|
<li><a href="#org9889d78">5.4. License</a></li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div id="outline-container-org4399fba" class="outline-2">
|
<div id="outline-container-orgff39d75" class="outline-2">
|
||||||
<h2 id="org4399fba"><span class="section-number-2">1.</span> Dependencies</h2>
|
<h2 id="orgff39d75"><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="orgb55ce99" border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">
|
<table id="org541a8e9" border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">
|
||||||
|
|
||||||
|
|
||||||
<colgroup>
|
<colgroup>
|
||||||
|
@ -299,21 +295,21 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="outline-container-org686fad8" class="outline-2">
|
<div id="outline-container-org4651c2d" class="outline-2">
|
||||||
<h2 id="org686fad8"><span class="section-number-2">2.</span> Error Conditions</h2>
|
<h2 id="org4651c2d"><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="orgca58a9e"><span style="color: #3c98e0;">(</span><span style="color: #93a61a; font-weight: bold;">define-condition-type</span> &wd-exception &error wd-exception?
|
<pre class="src src-scheme" id="orgbc037c3">(define-condition-type &wd-exception &error wd-exception?
|
||||||
<span style="color: #c49619;">(</span>stacktrace wd-stacktrace<span style="color: #c49619;">)</span>
|
(stacktrace wd-stacktrace)
|
||||||
<span style="color: #c49619;">(</span>data wd-data<span style="color: #c49619;">)</span><span style="color: #3c98e0;">)</span>
|
(data wd-data))
|
||||||
</pre>
|
</pre>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
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="org1b76a29" border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">
|
<table id="orgecaa72e" border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">
|
||||||
|
|
||||||
|
|
||||||
<colgroup>
|
<colgroup>
|
||||||
|
@ -472,23 +468,23 @@ Every API error code (key “error” in the returned JSON data) gets it
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="outline-container-orgb911463" class="outline-2">
|
<div id="outline-container-org6193099" class="outline-2">
|
||||||
<h2 id="orgb911463"><span class="section-number-2">3.</span> WebDriver</h2>
|
<h2 id="org6193099"><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="orgdcaa051"><span style="color: #3c98e0;">(</span><span style="color: #93a61a; font-weight: bold;">define-class</span> <span style="color: #c49619; font-style: italic;"><WebDriver></span> <span style="color: #c49619;">()</span>
|
<pre class="src src-scheme" id="org44a4d03">(<span style="font-weight: bold;">define-class</span> <span style="font-weight: bold; text-decoration: underline;"><WebDriver></span> ()
|
||||||
<span style="color: #c49619;">(</span><span style="color: #db5823;">(</span>browser #f<span style="color: #db5823;">)</span>
|
((browser #f)
|
||||||
<span style="color: #db5823;">(</span>active? #f<span style="color: #db5823;">)</span>
|
(active? #f)
|
||||||
<span style="color: #db5823;">(</span>browser-pid #f<span style="color: #db5823;">)</span>
|
(browser-pid #f)
|
||||||
<span style="color: #db5823;">(</span>server #f<span style="color: #db5823;">)</span>
|
(server #f)
|
||||||
<span style="color: #db5823;">(</span>port #f<span style="color: #db5823;">)</span>
|
(port #f)
|
||||||
<span style="color: #db5823;">(</span>session-id #f<span style="color: #db5823;">)</span>
|
(session-id #f)
|
||||||
<span style="color: #db5823;">(</span>prefs #f<span style="color: #db5823;">)</span>
|
(prefs #f)
|
||||||
<span style="color: #db5823;">(</span>capabilities #f<span style="color: #db5823;">)</span><span style="color: #c49619;">)</span><span style="color: #3c98e0;">)</span>
|
(capabilities #f)))
|
||||||
</pre>
|
</pre>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -497,22 +493,22 @@ 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="org47d44ea"><span style="color: #3c98e0;">(</span><span style="color: #93a61a; font-weight: bold;">define-method</span> <span style="color: #c49619;">(</span><span style="color: #3c98e0;">launch</span> <span style="color: #3c98e0; font-style: italic;">#:after</span> <span style="color: #db5823;">(</span>instance <span style="color: #c49619; font-style: italic;"><WebDriver></span><span style="color: #db5823;">)</span> options<span style="color: #c49619;">)</span>
|
<pre class="src src-scheme" id="orgf8c4322">(<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)
|
||||||
<span style="color: #c49619;">(</span>set-finalizer! instance <span style="color: #db5823;">(</span><span style="color: #93a61a; font-weight: bold;">lambda</span> <span style="color: #93a61a;">(</span>obj<span style="color: #93a61a;">)</span>
|
(set-finalizer! instance (<span style="font-weight: bold;">lambda</span> (obj)
|
||||||
<span style="color: #93a61a;">(</span><span style="color: #93a61a; font-weight: bold;">when</span> <span style="color: #3c98e0;">(</span>slot-value instance 'active?<span style="color: #3c98e0;">)</span>
|
(<span style="font-weight: bold;">when</span> (slot-value instance 'active?)
|
||||||
<span style="color: #3c98e0;">(</span>terminate instance<span style="color: #3c98e0;">)</span><span style="color: #93a61a;">)</span><span style="color: #db5823;">)</span><span style="color: #c49619;">)</span><span style="color: #3c98e0;">)</span>
|
(terminate instance)))))
|
||||||
|
|
||||||
<span style="color: #3c98e0;">(</span><span style="color: #93a61a; font-weight: bold;">define-method</span> <span style="color: #c49619;">(</span><span style="color: #3c98e0;">terminate</span> <span style="color: #db5823;">(</span>instance <span style="color: #c49619; font-style: italic;"><WebDriver></span><span style="color: #db5823;">)</span><span style="color: #c49619;">)</span>
|
(<span style="font-weight: bold;">define-method</span> (<span style="font-weight: bold;">terminate</span> (instance <span style="font-weight: bold; text-decoration: underline;"><WebDriver></span>))
|
||||||
<span style="color: #c49619;">(</span>terminate-session instance<span style="color: #c49619;">)</span>
|
(terminate-session instance)
|
||||||
<span style="color: #c49619;">(</span>process-signal <span style="color: #db5823;">(</span>slot-value instance 'browser-pid<span style="color: #db5823;">)</span><span style="color: #c49619;">)</span>
|
(process-signal (slot-value instance 'browser-pid))
|
||||||
<span style="color: #c49619;">(</span><span style="color: #93a61a; font-weight: bold;">set!</span> <span style="color: #db5823;">(</span>slot-value instance 'browser-pid<span style="color: #db5823;">)</span> #f<span style="color: #c49619;">)</span>
|
(set! (slot-value instance 'browser-pid) #f)
|
||||||
<span style="color: #c49619;">(</span><span style="color: #93a61a; font-weight: bold;">set!</span> <span style="color: #db5823;">(</span>slot-value instance 'active?<span style="color: #db5823;">)</span> #f<span style="color: #c49619;">)</span><span style="color: #3c98e0;">)</span>
|
(set! (slot-value instance 'active?) #f))
|
||||||
|
|
||||||
<span style="color: #3c98e0;">(</span><span style="color: #93a61a; font-weight: bold;">define-method</span> <span style="color: #c49619;">(</span><span style="color: #3c98e0;">construct-capabilities</span> <span style="color: #db5823;">(</span>instance <span style="color: #c49619; font-style: italic;"><WebDriver></span><span style="color: #db5823;">)</span> #!optional caps<span style="color: #c49619;">)</span>
|
(<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;"><WebDriver></span>) #!optional caps)
|
||||||
<span style="color: #c49619;">(</span>raise 'subclass-responsibility<span style="color: #c49619;">)</span><span style="color: #3c98e0;">)</span>
|
(raise 'subclass-responsibility))
|
||||||
|
|
||||||
<span style="color: #3c98e0;">(</span><span style="color: #93a61a; font-weight: bold;">define-method</span> <span style="color: #c49619;">(</span><span style="color: #3c98e0;">postprocess-result</span> <span style="color: #db5823;">(</span>instance <span style="color: #c49619; font-style: italic;"><WebDriver></span><span style="color: #db5823;">)</span> result<span style="color: #c49619;">)</span>
|
(<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;"><WebDriver></span>) result)
|
||||||
result<span style="color: #3c98e0;">)</span>
|
result)
|
||||||
</pre>
|
</pre>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -521,33 +517,33 @@ 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="org5798eb1"><span style="color: #3c98e0;">(</span><span style="color: #93a61a; font-weight: bold;">define</span> <span style="color: #c49619;">(</span><span style="color: #3c98e0;">new-WebDriver</span> browser #!optional options<span style="color: #c49619;">)</span>
|
<pre class="src src-scheme" id="org6bc1a19">(<span style="font-weight: bold;">define</span> (<span style="font-weight: bold;">new-WebDriver</span> browser #!optional options)
|
||||||
<span style="color: #c49619;">(</span><span style="color: #93a61a; font-weight: bold;">let</span> <span style="color: #db5823;">(</span><span style="color: #93a61a;">(</span>instance <span style="color: #3c98e0;">(</span>make browser<span style="color: #3c98e0;">)</span><span style="color: #93a61a;">)</span><span style="color: #db5823;">)</span>
|
(<span style="font-weight: bold;">let</span> ((instance (make browser)))
|
||||||
<span style="color: #db5823;">(</span>launch instance options<span style="color: #db5823;">)</span>
|
(launch instance options)
|
||||||
<span style="color: #db5823;">(</span>sleep <span style="color: #7a7ed2; font-weight: bold;">1</span><span style="color: #db5823;">)</span>
|
(sleep 1)
|
||||||
instance<span style="color: #c49619;">)</span><span style="color: #3c98e0;">)</span>
|
instance))
|
||||||
</pre>
|
</pre>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="outline-container-org3d13a0c" class="outline-3">
|
<div id="outline-container-org4f8bad8" class="outline-3">
|
||||||
<h3 id="org3d13a0c"><span class="section-number-3">3.1.</span> Geckodriver</h3>
|
<h3 id="org4f8bad8"><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="orge7a717b"><span style="color: #3c98e0;">(</span><span style="color: #93a61a; font-weight: bold;">define-class</span> <span style="color: #c49619; font-style: italic;"><Gecko></span> <span style="color: #c49619;">(</span><span style="color: #c49619; font-style: italic;"><WebDriver></span><span style="color: #c49619;">)</span>
|
<pre class="src src-scheme" id="orgd7e1d00">(<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>)
|
||||||
<span style="color: #c49619;">(</span><span style="color: #db5823;">(</span>browser <span style="color: #3c98e0; font-style: italic;">#:firefox</span><span style="color: #db5823;">)</span>
|
((browser <span style="font-weight: bold;">#:firefox</span>)
|
||||||
<span style="color: #db5823;">(</span>server <span style="color: #93a61a;">"127.0.0.1"</span><span style="color: #db5823;">)</span>
|
(server <span style="font-style: italic;">"127.0.0.1"</span>)
|
||||||
<span style="color: #db5823;">(</span>port <span style="color: #7a7ed2; font-weight: bold;">4444</span><span style="color: #db5823;">)</span><span style="color: #c49619;">)</span><span style="color: #3c98e0;">)</span>
|
(port 4444)))
|
||||||
|
|
||||||
<span style="color: #3c98e0;">(</span><span style="color: #93a61a; font-weight: bold;">define-method</span> <span style="color: #c49619;">(</span><span style="color: #3c98e0;">launch</span> <span style="color: #db5823;">(</span>instance <span style="color: #c49619; font-style: italic;"><Gecko></span><span style="color: #db5823;">)</span> options<span style="color: #c49619;">)</span>
|
(<span style="font-weight: bold;">define-method</span> (<span style="font-weight: bold;">launch</span> (instance <span style="font-weight: bold; text-decoration: underline;"><Gecko></span>) options)
|
||||||
<span style="color: #c49619;">(</span><span style="color: #93a61a; font-weight: bold;">let</span> <span style="color: #db5823;">(</span><span style="color: #93a61a;">(</span>pid <span style="color: #3c98e0;">(</span>process-run <span style="color: #93a61a;">"geckodriver > /dev/null 2>&1"</span><span style="color: #3c98e0;">)</span><span style="color: #93a61a;">)</span><span style="color: #db5823;">)</span>
|
(<span style="font-weight: bold;">let</span> ((pid (process-run <span style="font-style: italic;">"geckodriver > /dev/null 2>&1"</span>)))
|
||||||
<span style="color: #db5823;">(</span><span style="color: #93a61a; font-weight: bold;">set!</span> <span style="color: #93a61a;">(</span>slot-value instance 'browser-pid<span style="color: #93a61a;">)</span> pid<span style="color: #db5823;">)</span>
|
(set! (slot-value instance 'browser-pid) pid)
|
||||||
<span style="color: #db5823;">(</span><span style="color: #93a61a; font-weight: bold;">set!</span> <span style="color: #93a61a;">(</span>slot-value instance 'active?<span style="color: #93a61a;">)</span> #t<span style="color: #db5823;">)</span>
|
(set! (slot-value instance 'active?) #t)
|
||||||
<span style="color: #db5823;">(</span><span style="color: #93a61a; font-weight: bold;">set!</span> <span style="color: #93a61a;">(</span>slot-value instance 'capabilities<span style="color: #93a61a;">)</span> options<span style="color: #db5823;">)</span><span style="color: #c49619;">)</span><span style="color: #3c98e0;">)</span>
|
(set! (slot-value instance 'capabilities) options)))
|
||||||
</pre>
|
</pre>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -557,9 +553,9 @@ 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="org3337880"><span style="color: #3c98e0;">(</span><span style="color: #93a61a; font-weight: bold;">define-method</span> <span style="color: #c49619;">(</span><span style="color: #3c98e0;">construct-capabilities</span> <span style="color: #db5823;">(</span>instance <span style="color: #c49619; font-style: italic;"><Gecko></span><span style="color: #db5823;">)</span><span style="color: #c49619;">)</span>
|
<pre class="src src-scheme" id="org5a3ee36">(<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="color: #c49619;">(</span><span style="color: #93a61a; font-weight: bold;">let</span> <span style="color: #db5823;">(</span><span style="color: #93a61a;">(</span>caps <span style="color: #3c98e0;">(</span><span style="color: #93a61a; font-weight: bold;">or</span> <span style="color: #c49619;">(</span>slot-value instance 'capabilities<span style="color: #c49619;">)</span> <span style="color: #c49619;">(</span>list<span style="color: #c49619;">)</span><span style="color: #3c98e0;">)</span><span style="color: #93a61a;">)</span><span style="color: #db5823;">)</span>
|
(<span style="font-weight: bold;">let</span> ((caps (<span style="font-weight: bold;">or</span> (slot-value instance 'capabilities) (list))))
|
||||||
`<span style="color: #db5823;">(</span><span style="color: #93a61a;">(</span>capabilities . ,caps<span style="color: #93a61a;">)</span><span style="color: #db5823;">)</span><span style="color: #c49619;">)</span><span style="color: #3c98e0;">)</span>
|
`((capabilities . ,caps))))
|
||||||
</pre>
|
</pre>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -568,65 +564,65 @@ 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="org75d89a5"><span style="color: #3c98e0;">(</span><span style="color: #93a61a; font-weight: bold;">define-method</span> <span style="color: #c49619;">(</span><span style="color: #3c98e0;">postprocess-result</span> <span style="color: #db5823;">(</span>instance <span style="color: #c49619; font-style: italic;"><Gecko></span><span style="color: #db5823;">)</span> result<span style="color: #c49619;">)</span>
|
<pre class="src src-scheme" id="org6ddb4c4">(<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)
|
||||||
<span style="color: #c49619;">(</span>alist-ref/default result 'value result<span style="color: #c49619;">)</span><span style="color: #3c98e0;">)</span>
|
(alist-ref/default result 'value result))
|
||||||
</pre>
|
</pre>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="outline-container-orgf472d01" class="outline-2">
|
<div id="outline-container-org4680eae" class="outline-2">
|
||||||
<h2 id="orgf472d01"><span class="section-number-2">4.</span> WebDriver API</h2>
|
<h2 id="org4680eae"><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-org5685400" class="outline-3">
|
<div id="outline-container-orgb60d0eb" class="outline-3">
|
||||||
<h3 id="org5685400"><span class="section-number-3">4.1.</span> Communication</h3>
|
<h3 id="orgb60d0eb"><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="orgaf961e8"><span style="color: #3c98e0;">(</span><span style="color: #93a61a; font-weight: bold;">define-method</span> <span style="color: #c49619;">(</span><span style="color: #3c98e0;">send</span> <span style="color: #db5823;">(</span>instance <span style="color: #c49619; font-style: italic;"><WebDriver></span><span style="color: #db5823;">)</span> data uri method<span style="color: #c49619;">)</span>
|
<pre class="src src-scheme" id="org13f277a">(<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="color: #c49619;">(</span><span style="color: #93a61a; font-weight: bold;">let*</span> <span style="color: #db5823;">(</span><span style="color: #93a61a;">(</span>remote <span style="color: #3c98e0;">(</span>string-append <span style="color: #93a61a;">"http://"</span> <span style="color: #c49619;">(</span>slot-value instance 'server<span style="color: #c49619;">)</span> <span style="color: #93a61a;">":"</span> <span style="color: #c49619;">(</span>->string <span style="color: #db5823;">(</span>slot-value instance 'port<span style="color: #db5823;">)</span><span style="color: #c49619;">)</span> <span style="color: #93a61a;">"/"</span><span style="color: #3c98e0;">)</span><span style="color: #93a61a;">)</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>))
|
||||||
<span style="color: #93a61a;">(</span>result <span style="color: #3c98e0;">(</span>postprocess-result instance
|
(result (postprocess-result instance
|
||||||
<span style="color: #c49619;">(</span>with-input-from-request
|
(with-input-from-request
|
||||||
<span style="color: #db5823;">(</span>make-request <span style="color: #3c98e0; font-style: italic;">#:method</span> method
|
(make-request <span style="font-weight: bold;">#:method</span> method
|
||||||
<span style="color: #3c98e0; font-style: italic;">#:uri</span> <span style="color: #93a61a;">(</span>uri-reference <span style="color: #3c98e0;">(</span>string-append remote uri<span style="color: #3c98e0;">)</span><span style="color: #93a61a;">)</span>
|
<span style="font-weight: bold;">#:uri</span> (uri-reference (string-append remote uri))
|
||||||
<span style="color: #3c98e0; font-style: italic;">#:headers</span> <span style="color: #93a61a;">(</span>headers `<span style="color: #3c98e0;">(</span><span style="color: #c49619;">(</span>content-type application/json<span style="color: #c49619;">)</span><span style="color: #3c98e0;">)</span><span style="color: #93a61a;">)</span><span style="color: #db5823;">)</span>
|
<span style="font-weight: bold;">#:headers</span> (headers `((content-type application/json))))
|
||||||
<span style="color: #db5823;">(</span><span style="color: #93a61a; font-weight: bold;">if</span> data <span style="color: #93a61a;">(</span>json->string data<span style="color: #93a61a;">)</span> <span style="color: #93a61a;">""</span><span style="color: #db5823;">)</span>
|
(<span style="font-weight: bold;">if</span> data (json->string data) <span style="font-style: italic;">""</span>)
|
||||||
read-json<span style="color: #c49619;">)</span><span style="color: #3c98e0;">)</span><span style="color: #93a61a;">)</span><span style="color: #db5823;">)</span>
|
read-json))))
|
||||||
<span style="color: #db5823;">(</span><span style="color: #93a61a; font-weight: bold;">if</span> <span style="color: #93a61a;">(</span><span style="color: #93a61a; font-weight: bold;">and</span> <span style="color: #3c98e0;">(</span>list? result<span style="color: #3c98e0;">)</span> <span style="color: #3c98e0;">(</span>alist-ref/default result 'error #f<span style="color: #3c98e0;">)</span><span style="color: #93a61a;">)</span>
|
(<span style="font-weight: bold;">if</span> (<span style="font-weight: bold;">and</span> (list? result) (alist-ref/default result 'error #f))
|
||||||
<span style="color: #93a61a;">(</span>wd-throw result<span style="color: #93a61a;">)</span>
|
(wd-throw result)
|
||||||
result<span style="color: #db5823;">)</span><span style="color: #c49619;">)</span><span style="color: #3c98e0;">)</span>
|
result)))
|
||||||
|
|
||||||
<span style="color: #3c98e0;">(</span><span style="color: #93a61a; font-weight: bold;">define-method</span> <span style="color: #c49619;">(</span><span style="color: #3c98e0;">send-with-session</span> <span style="color: #db5823;">(</span>instance <span style="color: #c49619; font-style: italic;"><WebDriver></span><span style="color: #db5823;">)</span> data uri method<span style="color: #c49619;">)</span>
|
(<span style="font-weight: bold;">define-method</span> (<span style="font-weight: bold;">send-with-session</span> (instance <span style="font-weight: bold; text-decoration: underline;"><WebDriver></span>) data uri method)
|
||||||
<span style="color: #c49619;">(</span>send instance data <span style="color: #db5823;">(</span>string-append <span style="color: #93a61a;">"session/"</span> <span style="color: #93a61a;">(</span>slot-value instance 'session-id<span style="color: #93a61a;">)</span> <span style="color: #93a61a;">"/"</span> uri<span style="color: #db5823;">)</span> method<span style="color: #c49619;">)</span><span style="color: #3c98e0;">)</span>
|
(send instance data (string-append <span style="font-style: italic;">"session/"</span> (slot-value instance 'session-id) <span style="font-style: italic;">"/"</span> uri) method))
|
||||||
</pre>
|
</pre>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="outline-container-orgd3b1c20" class="outline-3">
|
<div id="outline-container-org2a85680" class="outline-3">
|
||||||
<h3 id="orgd3b1c20"><span class="section-number-3">4.2.</span> Session management</h3>
|
<h3 id="org2a85680"><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="org9cfce71"><span style="color: #3c98e0;">(</span><span style="color: #93a61a; font-weight: bold;">define-method</span> <span style="color: #c49619;">(</span><span style="color: #3c98e0;">initialize-session</span> <span style="color: #db5823;">(</span>instance <span style="color: #c49619; font-style: italic;"><WebDriver></span><span style="color: #db5823;">)</span><span style="color: #c49619;">)</span>
|
<pre class="src src-scheme" id="org31bcb1b">(<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="color: #c49619;">(</span><span style="color: #93a61a; font-weight: bold;">let</span> <span style="color: #db5823;">(</span><span style="color: #93a61a;">(</span>result <span style="color: #3c98e0;">(</span>send instance <span style="color: #c49619;">(</span>construct-capabilities instance<span style="color: #c49619;">)</span> <span style="color: #93a61a;">"session"</span> 'POST<span style="color: #3c98e0;">)</span><span style="color: #93a61a;">)</span><span style="color: #db5823;">)</span>
|
(<span style="font-weight: bold;">let</span> ((result (send instance (construct-capabilities instance) <span style="font-style: italic;">"session"</span> 'POST)))
|
||||||
<span style="color: #db5823;">(</span><span style="color: #93a61a; font-weight: bold;">set!</span> <span style="color: #93a61a;">(</span>slot-value instance 'session-id<span style="color: #93a61a;">)</span> <span style="color: #93a61a;">(</span>alist-ref result 'sessionId<span style="color: #93a61a;">)</span><span style="color: #db5823;">)</span><span style="color: #c49619;">)</span><span style="color: #3c98e0;">)</span>
|
(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="org73e6879"><span style="color: #3c98e0;">(</span><span style="color: #93a61a; font-weight: bold;">define-method</span> <span style="color: #c49619;">(</span><span style="color: #3c98e0;">terminate-session</span> <span style="color: #db5823;">(</span>instance <span style="color: #c49619; font-style: italic;"><WebDriver></span><span style="color: #db5823;">)</span><span style="color: #c49619;">)</span>
|
<pre class="src src-scheme" id="orgf32e94f">(<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="color: #c49619;">(</span><span style="color: #93a61a; font-weight: bold;">when</span> <span style="color: #db5823;">(</span>slot-value instance 'session-id<span style="color: #db5823;">)</span>
|
(<span style="font-weight: bold;">when</span> (slot-value instance 'session-id)
|
||||||
<span style="color: #db5823;">(</span>send instance #f <span style="color: #93a61a;">(</span>string-append <span style="color: #93a61a;">"session/"</span> <span style="color: #3c98e0;">(</span>slot-value instance 'session-id<span style="color: #3c98e0;">)</span><span style="color: #93a61a;">)</span> 'DELETE<span style="color: #db5823;">)</span><span style="color: #c49619;">)</span>
|
(send instance #f (string-append <span style="font-style: italic;">"session/"</span> (slot-value instance 'session-id)) 'DELETE))
|
||||||
<span style="color: #c49619;">(</span><span style="color: #93a61a; font-weight: bold;">set!</span> <span style="color: #db5823;">(</span>slot-value instance 'session-id<span style="color: #db5823;">)</span> #f<span style="color: #c49619;">)</span><span style="color: #3c98e0;">)</span>
|
(set! (slot-value instance 'session-id) #f))
|
||||||
</pre>
|
</pre>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -635,22 +631,22 @@ Session management is very simple. There is just one method to initialize a new
|
||||||
Initial state ........................................................ [ PASS]
|
Initial state ........................................................ [ PASS]
|
||||||
Session id check ..................................................... [ PASS]
|
Session id check ..................................................... [ PASS]
|
||||||
Session id after termination ......................................... [ PASS]
|
Session id after termination ......................................... [ PASS]
|
||||||
3 tests completed in 4.952 seconds.
|
3 tests completed in 3.788 seconds.
|
||||||
3 out of 3 (100%) tests passed.
|
3 out of 3 (100%) tests passed.
|
||||||
-- done testing session ------------------------------------------------------
|
-- done testing session ------------------------------------------------------
|
||||||
</pre>
|
</pre>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="outline-container-orgca687e8" class="outline-3">
|
<div id="outline-container-org50c43d3" class="outline-3">
|
||||||
<h3 id="orgca687e8"><span class="section-number-3">4.3.</span> API Access Methods</h3>
|
<h3 id="org50c43d3"><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="org9ede152"><span style="color: #3c98e0;">(</span><span style="color: #93a61a; font-weight: bold;">define-method</span> <span style="color: #c49619;">(</span><span style="color: #3c98e0;">set-url</span> <span style="color: #db5823;">(</span>instance <span style="color: #c49619; font-style: italic;"><WebDriver></span><span style="color: #db5823;">)</span> url<span style="color: #c49619;">)</span>
|
<pre class="src src-scheme" id="org9ff460f">(<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)
|
||||||
<span style="color: #c49619;">(</span>send-with-session instance `<span style="color: #db5823;">(</span><span style="color: #93a61a;">(</span>url . ,url<span style="color: #93a61a;">)</span><span style="color: #db5823;">)</span> <span style="color: #93a61a;">"url"</span> 'POST<span style="color: #c49619;">)</span><span style="color: #3c98e0;">)</span>
|
(send-with-session instance `((url . ,url)) <span style="font-style: italic;">"url"</span> 'POST))
|
||||||
|
|
||||||
<span style="color: #3c98e0;">(</span><span style="color: #93a61a; font-weight: bold;">define-method</span> <span style="color: #c49619;">(</span><span style="color: #3c98e0;">url</span> <span style="color: #db5823;">(</span>instance <span style="color: #c49619; font-style: italic;"><WebDriver></span><span style="color: #db5823;">)</span><span style="color: #c49619;">)</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>))
|
||||||
<span style="color: #c49619;">(</span>send-with-session instance #f <span style="color: #93a61a;">"url"</span> 'GET<span style="color: #c49619;">)</span><span style="color: #3c98e0;">)</span>
|
(send-with-session instance #f <span style="font-style: italic;">"url"</span> 'GET))
|
||||||
</pre>
|
</pre>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -658,200 +654,200 @@ Session id after termination ......................................... [ PASS]
|
||||||
-- testing url ---------------------------------------------------------------
|
-- testing url ---------------------------------------------------------------
|
||||||
Initial state ........................................................ [ PASS]
|
Initial state ........................................................ [ PASS]
|
||||||
Navigating to the first website ...................................... [ PASS]
|
Navigating to the first website ...................................... [ PASS]
|
||||||
2 tests completed in 5.471 seconds.
|
2 tests completed in 5.247 seconds.
|
||||||
2 out of 2 (100%) tests passed.
|
2 out of 2 (100%) tests passed.
|
||||||
-- done testing url ----------------------------------------------------------
|
-- done testing url ----------------------------------------------------------
|
||||||
</pre>
|
</pre>
|
||||||
|
|
||||||
|
|
||||||
<div class="org-src-container">
|
<div class="org-src-container">
|
||||||
<pre class="src src-scheme"><span style="color: #3c98e0;">(</span><span style="color: #93a61a; font-weight: bold;">define-method</span> <span style="color: #c49619;">(</span><span style="color: #3c98e0;">back</span> <span style="color: #db5823;">(</span>instance <span style="color: #c49619; font-style: italic;"><WebDriver></span><span style="color: #db5823;">)</span><span style="color: #c49619;">)</span>
|
<pre class="src src-scheme">(<span style="font-weight: bold;">define-method</span> (<span style="font-weight: bold;">back</span> (instance <span style="font-weight: bold; text-decoration: underline;"><WebDriver></span>))
|
||||||
<span style="color: #c49619;">(</span>send-with-session instance #f <span style="color: #93a61a;">"back"</span> 'POST<span style="color: #c49619;">)</span><span style="color: #3c98e0;">)</span>
|
(send-with-session instance #f <span style="font-style: italic;">"back"</span> 'POST))
|
||||||
</pre>
|
</pre>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="org-src-container">
|
<div class="org-src-container">
|
||||||
<pre class="src src-scheme"><span style="color: #3c98e0;">(</span><span style="color: #93a61a; font-weight: bold;">define-method</span> <span style="color: #c49619;">(</span><span style="color: #3c98e0;">forward</span> <span style="color: #db5823;">(</span>instance <span style="color: #c49619; font-style: italic;"><WebDriver></span><span style="color: #db5823;">)</span><span style="color: #c49619;">)</span>
|
<pre class="src src-scheme">(<span style="font-weight: bold;">define-method</span> (<span style="font-weight: bold;">forward</span> (instance <span style="font-weight: bold; text-decoration: underline;"><WebDriver></span>))
|
||||||
<span style="color: #c49619;">(</span>send-with-session instance #f <span style="color: #93a61a;">"forward"</span> 'POST<span style="color: #c49619;">)</span><span style="color: #3c98e0;">)</span>
|
(send-with-session instance #f <span style="font-style: italic;">"forward"</span> 'POST))
|
||||||
</pre>
|
</pre>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="org-src-container">
|
<div class="org-src-container">
|
||||||
<pre class="src src-scheme"><span style="color: #3c98e0;">(</span><span style="color: #93a61a; font-weight: bold;">define-method</span> <span style="color: #c49619;">(</span><span style="color: #3c98e0;">forward</span> <span style="color: #db5823;">(</span>instance <span style="color: #c49619; font-style: italic;"><WebDriver></span><span style="color: #db5823;">)</span><span style="color: #c49619;">)</span>
|
<pre class="src src-scheme">(<span style="font-weight: bold;">define-method</span> (<span style="font-weight: bold;">refresh</span> (instance <span style="font-weight: bold; text-decoration: underline;"><WebDriver></span>))
|
||||||
<span style="color: #c49619;">(</span>send-with-session instance #f <span style="color: #93a61a;">"refresh"</span> 'POST<span style="color: #c49619;">)</span><span style="color: #3c98e0;">)</span>
|
(send-with-session instance #f <span style="font-style: italic;">"refresh"</span> 'POST))
|
||||||
</pre>
|
</pre>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="org-src-container">
|
<div class="org-src-container">
|
||||||
<pre class="src src-scheme"><span style="color: #3c98e0;">(</span><span style="color: #93a61a; font-weight: bold;">define-method</span> <span style="color: #c49619;">(</span><span style="color: #3c98e0;">title</span> <span style="color: #db5823;">(</span>instance <span style="color: #c49619; font-style: italic;"><WebDriver></span><span style="color: #db5823;">)</span><span style="color: #c49619;">)</span>
|
<pre class="src src-scheme">(<span style="font-weight: bold;">define-method</span> (<span style="font-weight: bold;">title</span> (instance <span style="font-weight: bold; text-decoration: underline;"><WebDriver></span>))
|
||||||
<span style="color: #c49619;">(</span>send-with-session instance #f <span style="color: #93a61a;">"title"</span> 'GET<span style="color: #c49619;">)</span><span style="color: #3c98e0;">)</span>
|
(send-with-session instance #f <span style="font-style: italic;">"title"</span> 'GET))
|
||||||
</pre>
|
</pre>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="org-src-container">
|
<div class="org-src-container">
|
||||||
<pre class="src src-scheme"><span style="color: #3c98e0;">(</span><span style="color: #93a61a; font-weight: bold;">define-method</span> <span style="color: #c49619;">(</span><span style="color: #3c98e0;">status</span> <span style="color: #db5823;">(</span>instance <span style="color: #c49619; font-style: italic;"><WebDriver></span><span style="color: #db5823;">)</span><span style="color: #c49619;">)</span>
|
<pre class="src src-scheme">(<span style="font-weight: bold;">define-method</span> (<span style="font-weight: bold;">status</span> (instance <span style="font-weight: bold; text-decoration: underline;"><WebDriver></span>))
|
||||||
<span style="color: #c49619;">(</span>send-with-session instance #f <span style="color: #93a61a;">"status"</span> 'GET<span style="color: #c49619;">)</span><span style="color: #3c98e0;">)</span>
|
(send-with-session instance #f <span style="font-style: italic;">"status"</span> 'GET))
|
||||||
</pre>
|
</pre>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="org-src-container">
|
<div class="org-src-container">
|
||||||
<pre class="src src-scheme"><span style="color: #3c98e0;">(</span><span style="color: #93a61a; font-weight: bold;">define-method</span> <span style="color: #c49619;">(</span><span style="color: #3c98e0;">source</span> <span style="color: #db5823;">(</span>instance <span style="color: #c49619; font-style: italic;"><WebDriver></span><span style="color: #db5823;">)</span><span style="color: #c49619;">)</span>
|
<pre class="src src-scheme">(<span style="font-weight: bold;">define-method</span> (<span style="font-weight: bold;">source</span> (instance <span style="font-weight: bold; text-decoration: underline;"><WebDriver></span>))
|
||||||
<span style="color: #c49619;">(</span>send-with-session instance #f <span style="color: #93a61a;">"source"</span> 'GET<span style="color: #c49619;">)</span><span style="color: #3c98e0;">)</span>
|
(send-with-session instance #f <span style="font-style: italic;">"source"</span> 'GET))
|
||||||
</pre>
|
</pre>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="org-src-container">
|
<div class="org-src-container">
|
||||||
<pre class="src src-scheme"><span style="color: #3c98e0;">(</span><span style="color: #93a61a; font-weight: bold;">define-method</span> <span style="color: #c49619;">(</span><span style="color: #3c98e0;">screenshot</span> <span style="color: #db5823;">(</span>instance <span style="color: #c49619; font-style: italic;"><WebDriver></span><span style="color: #db5823;">)</span><span style="color: #c49619;">)</span>
|
<pre class="src src-scheme">(<span style="font-weight: bold;">define-method</span> (<span style="font-weight: bold;">screenshot</span> (instance <span style="font-weight: bold; text-decoration: underline;"><WebDriver></span>))
|
||||||
<span style="color: #c49619;">(</span>base64-decode <span style="color: #db5823;">(</span>send-with-session instance #f <span style="color: #93a61a;">"screenshot"</span> 'GET<span style="color: #db5823;">)</span><span style="color: #c49619;">)</span><span style="color: #3c98e0;">)</span>
|
(base64-decode (send-with-session instance #f <span style="font-style: italic;">"screenshot"</span> 'GET)))
|
||||||
</pre>
|
</pre>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="org-src-container">
|
<div class="org-src-container">
|
||||||
<pre class="src src-scheme"><span style="color: #3c98e0;">(</span><span style="color: #93a61a; font-weight: bold;">define-method</span> <span style="color: #c49619;">(</span><span style="color: #3c98e0;">print-page</span> <span style="color: #db5823;">(</span>instance <span style="color: #c49619; font-style: italic;"><WebDriver></span><span style="color: #db5823;">)</span><span style="color: #c49619;">)</span>
|
<pre class="src src-scheme">(<span style="font-weight: bold;">define-method</span> (<span style="font-weight: bold;">print-page</span> (instance <span style="font-weight: bold; text-decoration: underline;"><WebDriver></span>))
|
||||||
<span style="color: #c49619;">(</span>send-with-session instance #f <span style="color: #93a61a;">"print"</span> 'POST<span style="color: #c49619;">)</span><span style="color: #3c98e0;">)</span>
|
(send-with-session instance #f <span style="font-style: italic;">"print"</span> 'POST))
|
||||||
</pre>
|
</pre>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="org-src-container">
|
<div class="org-src-container">
|
||||||
<pre class="src src-scheme"><span style="color: #3c98e0;">(</span><span style="color: #93a61a; font-weight: bold;">define-method</span> <span style="color: #c49619;">(</span><span style="color: #3c98e0;">execute-async</span> <span style="color: #db5823;">(</span>instance <span style="color: #c49619; font-style: italic;"><WebDriver></span><span style="color: #db5823;">)</span> script args<span style="color: #c49619;">)</span>
|
<pre class="src src-scheme">(<span style="font-weight: bold;">define-method</span> (<span style="font-weight: bold;">execute-async</span> (instance <span style="font-weight: bold; text-decoration: underline;"><WebDriver></span>) script args)
|
||||||
<span style="color: #c49619;">(</span>send-with-session instance `<span style="color: #db5823;">(</span><span style="color: #93a61a;">(</span>script . ,script<span style="color: #93a61a;">)</span> <span style="color: #93a61a;">(</span>args . ,args<span style="color: #93a61a;">)</span><span style="color: #db5823;">)</span> <span style="color: #93a61a;">"execute/async"</span> 'POST<span style="color: #c49619;">)</span><span style="color: #3c98e0;">)</span>
|
(send-with-session instance `((script . ,script) (args . ,args)) <span style="font-style: italic;">"execute/async"</span> 'POST))
|
||||||
</pre>
|
</pre>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="org-src-container">
|
<div class="org-src-container">
|
||||||
<pre class="src src-scheme"><span style="color: #3c98e0;">(</span><span style="color: #93a61a; font-weight: bold;">define-method</span> <span style="color: #c49619;">(</span><span style="color: #3c98e0;">execute-sync</span> <span style="color: #db5823;">(</span>instance <span style="color: #c49619; font-style: italic;"><WebDriver></span><span style="color: #db5823;">)</span> script args<span style="color: #c49619;">)</span>
|
<pre class="src src-scheme">(<span style="font-weight: bold;">define-method</span> (<span style="font-weight: bold;">execute-sync</span> (instance <span style="font-weight: bold; text-decoration: underline;"><WebDriver></span>) script args)
|
||||||
<span style="color: #c49619;">(</span>send-with-session instance `<span style="color: #db5823;">(</span><span style="color: #93a61a;">(</span>script . ,script<span style="color: #93a61a;">)</span> <span style="color: #93a61a;">(</span>args . ,args<span style="color: #93a61a;">)</span><span style="color: #db5823;">)</span> <span style="color: #93a61a;">"execute/sync"</span> 'POST<span style="color: #c49619;">)</span><span style="color: #3c98e0;">)</span>
|
(send-with-session instance `((script . ,script) (args . ,args)) <span style="font-style: italic;">"execute/sync"</span> 'POST))
|
||||||
</pre>
|
</pre>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="outline-container-org8175c38" class="outline-3">
|
<div id="outline-container-org970cd9c" class="outline-3">
|
||||||
<h3 id="org8175c38"><span class="section-number-3">4.4.</span> Timeouts</h3>
|
<h3 id="org970cd9c"><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:
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<ul class="org-ul">
|
<ul class="org-ul">
|
||||||
<li><code>script</code>: defaults to 30’000, specifies when to interrupt a script that is being evaluated. A nil value implies that scripts should never be interrupted, but instead run indefinitely.</li>
|
<li><code>script</code>: defaults to 30'000, specifies when to interrupt a script that is being evaluated. A nil value implies that scripts should never be interrupted, but instead run indefinitely.</li>
|
||||||
<li><code>pageLoad</code>: defaults to 300’000, provides the timeout limit used to interrupt an explicit navigation attempt.</li>
|
<li><code>pageLoad</code>: defaults to 300'000, provides the timeout limit used to interrupt an explicit navigation attempt.</li>
|
||||||
<li><code>implicit</code>: defaults to 0, specifies a time to wait for the element location strategy to complete when locating an element.</li>
|
<li><code>implicit</code>: defaults to 0, specifies a time to wait for the element location strategy to complete when locating an element.</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<div class="org-src-container">
|
<div class="org-src-container">
|
||||||
<pre class="src src-scheme"><span style="color: #3c98e0;">(</span><span style="color: #93a61a; font-weight: bold;">define-class</span> <span style="color: #c49619; font-style: italic;"><WDTimeouts></span> <span style="color: #c49619;">()</span>
|
<pre class="src src-scheme">(<span style="font-weight: bold;">define-class</span> <span style="font-weight: bold; text-decoration: underline;"><WDTimeouts></span> ()
|
||||||
<span style="color: #c49619;">(</span><span style="color: #db5823;">(</span>script <span style="color: #7a7ed2; font-weight: bold;">30000</span><span style="color: #db5823;">)</span>
|
((script 30000)
|
||||||
<span style="color: #db5823;">(</span>pageLoad <span style="color: #7a7ed2; font-weight: bold;">300000</span><span style="color: #db5823;">)</span>
|
(pageLoad 300000)
|
||||||
<span style="color: #db5823;">(</span>implicit <span style="color: #7a7ed2; font-weight: bold;">0</span><span style="color: #db5823;">)</span><span style="color: #c49619;">)</span><span style="color: #3c98e0;">)</span>
|
(implicit 0)))
|
||||||
</pre>
|
</pre>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="org-src-container">
|
<div class="org-src-container">
|
||||||
<pre class="src src-scheme"><span style="color: #3c98e0;">(</span><span style="color: #93a61a; font-weight: bold;">define-method</span> <span style="color: #c49619;">(</span><span style="color: #3c98e0;">extract</span> <span style="color: #db5823;">(</span>instance <span style="color: #c49619; font-style: italic;"><WDTimeouts></span><span style="color: #db5823;">)</span><span style="color: #c49619;">)</span>
|
<pre class="src src-scheme">(<span style="font-weight: bold;">define-method</span> (<span style="font-weight: bold;">extract</span> (instance <span style="font-weight: bold; text-decoration: underline;"><WDTimeouts></span>))
|
||||||
`<span style="color: #c49619;">(</span><span style="color: #db5823;">(</span>script . ,<span style="color: #93a61a;">(</span>slot-value instance 'script<span style="color: #93a61a;">)</span><span style="color: #db5823;">)</span>
|
`((script . ,(slot-value instance 'script))
|
||||||
<span style="color: #db5823;">(</span>pageLoad . ,<span style="color: #93a61a;">(</span>slot-value instance 'pageLoad<span style="color: #93a61a;">)</span><span style="color: #db5823;">)</span>
|
(pageLoad . ,(slot-value instance 'pageLoad))
|
||||||
<span style="color: #db5823;">(</span>implicit . ,<span style="color: #93a61a;">(</span>slot-value instance 'implicit<span style="color: #93a61a;">)</span><span style="color: #db5823;">)</span><span style="color: #c49619;">)</span><span style="color: #3c98e0;">)</span>
|
(implicit . ,(slot-value instance 'implicit))))
|
||||||
</pre>
|
</pre>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="outline-container-org2be29cc" class="outline-4">
|
<div id="outline-container-orgc089ded" class="outline-4">
|
||||||
<h4 id="org2be29cc"><span class="section-number-4">4.4.1.</span> Setting and getting timeouts</h4>
|
<h4 id="orgc089ded"><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="color: #3c98e0;">(</span><span style="color: #93a61a; font-weight: bold;">define-method</span> <span style="color: #c49619;">(</span><span style="color: #3c98e0;">set-timeouts</span> <span style="color: #db5823;">(</span>instance <span style="color: #c49619; font-style: italic;"><WebDriver></span><span style="color: #db5823;">)</span> <span style="color: #db5823;">(</span>timeouts <span style="color: #c49619; font-style: italic;"><WDTimeouts></span><span style="color: #db5823;">)</span><span style="color: #c49619;">)</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>))
|
||||||
<span style="color: #c49619;">(</span>send-with-session instance <span style="color: #db5823;">(</span>extract timeouts<span style="color: #db5823;">)</span> <span style="color: #93a61a;">"timeouts"</span> 'POST<span style="color: #c49619;">)</span><span style="color: #3c98e0;">)</span>
|
(send-with-session instance (extract timeouts) <span style="font-style: italic;">"timeouts"</span> 'POST))
|
||||||
|
|
||||||
<span style="color: #3c98e0;">(</span><span style="color: #93a61a; font-weight: bold;">define-method</span> <span style="color: #c49619;">(</span><span style="color: #3c98e0;">timeouts</span> <span style="color: #db5823;">(</span>instance <span style="color: #c49619; font-style: italic;"><WebDriver></span><span style="color: #db5823;">)</span><span style="color: #c49619;">)</span>
|
(<span style="font-weight: bold;">define-method</span> (<span style="font-weight: bold;">timeouts</span> (instance <span style="font-weight: bold; text-decoration: underline;"><WebDriver></span>))
|
||||||
<span style="color: #c49619;">(</span><span style="color: #93a61a; font-weight: bold;">let</span> <span style="color: #db5823;">(</span><span style="color: #93a61a;">(</span>result <span style="color: #3c98e0;">(</span>send-with-session instance #f <span style="color: #93a61a;">"timeouts"</span> 'GET<span style="color: #3c98e0;">)</span><span style="color: #93a61a;">)</span><span style="color: #db5823;">)</span>
|
(<span style="font-weight: bold;">let</span> ((result (send-with-session instance #f <span style="font-style: italic;">"timeouts"</span> 'GET)))
|
||||||
<span style="color: #db5823;">(</span>make <span style="color: #c49619; font-style: italic;"><WDTimeouts></span>
|
(make <span style="font-weight: bold; text-decoration: underline;"><WDTimeouts></span>
|
||||||
'script <span style="color: #93a61a;">(</span>alist-ref result 'script<span style="color: #93a61a;">)</span>
|
'script (alist-ref result 'script)
|
||||||
'pageLoad <span style="color: #93a61a;">(</span>alist-ref result 'pageLoad<span style="color: #93a61a;">)</span>
|
'pageLoad (alist-ref result 'pageLoad)
|
||||||
'implicit <span style="color: #93a61a;">(</span>alist-ref result 'implicit<span style="color: #93a61a;">)</span><span style="color: #db5823;">)</span><span style="color: #c49619;">)</span><span style="color: #3c98e0;">)</span>
|
'implicit (alist-ref result 'implicit))))
|
||||||
</pre>
|
</pre>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="outline-container-org0b96887" class="outline-3">
|
<div id="outline-container-org8473447" class="outline-3">
|
||||||
<h3 id="org0b96887"><span class="section-number-3">4.5.</span> Elements</h3>
|
<h3 id="org8473447"><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-org3abeb2f" class="outline-4">
|
<div id="outline-container-org870ddb2" class="outline-4">
|
||||||
<h4 id="org3abeb2f"><span class="section-number-4">4.5.1.</span> Element Class</h4>
|
<h4 id="org870ddb2"><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="color: #3c98e0;">(</span><span style="color: #93a61a; font-weight: bold;">define-class</span> <span style="color: #c49619; font-style: italic;"><WDElement></span> <span style="color: #c49619;">()</span>
|
<pre class="src src-scheme">(<span style="font-weight: bold;">define-class</span> <span style="font-weight: bold; text-decoration: underline;"><WDElement></span> ()
|
||||||
<span style="color: #c49619;">(</span><span style="color: #db5823;">(</span>driver #f<span style="color: #db5823;">)</span>
|
((driver #f)
|
||||||
<span style="color: #db5823;">(</span>element #f<span style="color: #db5823;">)</span><span style="color: #c49619;">)</span><span style="color: #3c98e0;">)</span>
|
(element #f)))
|
||||||
</pre>
|
</pre>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="org-src-container">
|
<div class="org-src-container">
|
||||||
<pre class="src src-scheme"><span style="color: #3c98e0;">(</span><span style="color: #93a61a; font-weight: bold;">define-method</span> <span style="color: #c49619;">(</span><span style="color: #3c98e0;">send-with-session</span> <span style="color: #db5823;">(</span>instance <span style="color: #c49619; font-style: italic;"><WDElement></span><span style="color: #db5823;">)</span> data uri method<span style="color: #c49619;">)</span>
|
<pre class="src src-scheme">(<span style="font-weight: bold;">define-method</span> (<span style="font-weight: bold;">send-with-session</span> (instance <span style="font-weight: bold; text-decoration: underline;"><WDElement></span>) data uri method)
|
||||||
<span style="color: #c49619;">(</span>send-with-session <span style="color: #db5823;">(</span>slot-value instance 'driver<span style="color: #db5823;">)</span> data
|
(send-with-session (slot-value instance 'driver) data
|
||||||
<span style="color: #db5823;">(</span>string-append <span style="color: #93a61a;">"element/"</span> <span style="color: #93a61a;">(</span>slot-value instance 'element<span style="color: #93a61a;">)</span> <span style="color: #93a61a;">"/"</span> uri<span style="color: #db5823;">)</span>
|
(string-append <span style="font-style: italic;">"element/"</span> (slot-value instance 'element) <span style="font-style: italic;">"/"</span> uri)
|
||||||
method<span style="color: #c49619;">)</span><span style="color: #3c98e0;">)</span>
|
method))
|
||||||
</pre>
|
</pre>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="outline-container-orgf5ba942" class="outline-4">
|
<div id="outline-container-org3abcade" class="outline-4">
|
||||||
<h4 id="orgf5ba942"><span class="section-number-4">4.5.2.</span> Finding Elements</h4>
|
<h4 id="org3abcade"><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="org4cf0712"></a>Location Strategies<br />
|
<li><a id="org671c47f"></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="color: #3c98e0;">(</span><span style="color: #93a61a; font-weight: bold;">define</span> <span style="color: #3c98e0;">css-selector</span> <span style="color: #93a61a;">"css selector"</span><span style="color: #3c98e0;">)</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>)
|
||||||
<span style="color: #3c98e0;">(</span><span style="color: #93a61a; font-weight: bold;">define</span> <span style="color: #3c98e0;">link-text</span> <span style="color: #93a61a;">"link text"</span><span style="color: #3c98e0;">)</span>
|
(<span style="font-weight: bold;">define</span> <span style="font-weight: bold;">link-text</span> <span style="font-style: italic;">"link text"</span>)
|
||||||
<span style="color: #3c98e0;">(</span><span style="color: #93a61a; font-weight: bold;">define</span> <span style="color: #3c98e0;">partial-link-text</span> <span style="color: #93a61a;">"partial link text"</span><span style="color: #3c98e0;">)</span>
|
(<span style="font-weight: bold;">define</span> <span style="font-weight: bold;">partial-link-text</span> <span style="font-style: italic;">"partial link text"</span>)
|
||||||
<span style="color: #3c98e0;">(</span><span style="color: #93a61a; font-weight: bold;">define</span> <span style="color: #3c98e0;">tag-name</span> <span style="color: #93a61a;">"tag name"</span><span style="color: #3c98e0;">)</span>
|
(<span style="font-weight: bold;">define</span> <span style="font-weight: bold;">tag-name</span> <span style="font-style: italic;">"tag name"</span>)
|
||||||
<span style="color: #3c98e0;">(</span><span style="color: #93a61a; font-weight: bold;">define</span> <span style="color: #3c98e0;">xpath</span> <span style="color: #93a61a;">"xpath"</span><span style="color: #3c98e0;">)</span>
|
(<span style="font-weight: bold;">define</span> <span style="font-weight: bold;">xpath</span> <span style="font-style: italic;">"xpath"</span>)
|
||||||
</pre>
|
</pre>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
<li><a id="orga7a21a2"></a>Accessor Methods<br />
|
<li><a id="orgd2e56a5"></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="color: #3c98e0;">(</span><span style="color: #93a61a; font-weight: bold;">define-method</span> <span style="color: #c49619;">(</span><span style="color: #3c98e0;">find-element</span> <span style="color: #db5823;">(</span>instance <span style="color: #c49619; font-style: italic;"><WebDriver></span><span style="color: #db5823;">)</span> strategy selector<span style="color: #c49619;">)</span>
|
<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="color: #c49619;">(</span><span style="color: #93a61a; font-weight: bold;">let</span> <span style="color: #db5823;">(</span><span style="color: #93a61a;">(</span>result <span style="color: #3c98e0;">(</span>send-with-session instance `<span style="color: #c49619;">(</span><span style="color: #db5823;">(</span>using . ,strategy<span style="color: #db5823;">)</span> <span style="color: #db5823;">(</span>value . ,selector<span style="color: #db5823;">)</span><span style="color: #c49619;">)</span> <span style="color: #93a61a;">"element"</span> 'POST<span style="color: #3c98e0;">)</span><span style="color: #93a61a;">)</span><span style="color: #db5823;">)</span>
|
(<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="color: #db5823;">(</span>make <span style="color: #c49619; font-style: italic;"><WDElement></span> 'driver instance 'element <span style="color: #93a61a;">(</span>car <span style="color: #3c98e0;">(</span>alist-values result<span style="color: #3c98e0;">)</span><span style="color: #93a61a;">)</span><span style="color: #db5823;">)</span>
|
(make <span style="font-weight: bold; text-decoration: underline;"><WDElement></span> 'driver instance 'element (car (alist-values result)))
|
||||||
element<span style="color: #c49619;">)</span><span style="color: #3c98e0;">)</span>
|
element))
|
||||||
</pre>
|
</pre>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="org-src-container">
|
<div class="org-src-container">
|
||||||
<pre class="src src-scheme"><span style="color: #3c98e0;">(</span><span style="color: #93a61a; font-weight: bold;">define-method</span> <span style="color: #c49619;">(</span><span style="color: #3c98e0;">find-elements</span> <span style="color: #db5823;">(</span>instance <span style="color: #c49619; font-style: italic;"><WebDriver></span><span style="color: #db5823;">)</span> strategy selector<span style="color: #c49619;">)</span>
|
<pre class="src src-scheme">(<span style="font-weight: bold;">define-method</span> (<span style="font-weight: bold;">find-elements</span> (instance <span style="font-weight: bold; text-decoration: underline;"><WebDriver></span>) strategy selector)
|
||||||
<span style="color: #c49619;">(</span><span style="color: #93a61a; font-weight: bold;">let</span> <span style="color: #db5823;">(</span><span style="color: #93a61a;">(</span>result <span style="color: #3c98e0;">(</span>send-with-session instance `<span style="color: #c49619;">(</span><span style="color: #db5823;">(</span>using . ,strategy<span style="color: #db5823;">)</span> <span style="color: #db5823;">(</span>value . ,selector<span style="color: #db5823;">)</span><span style="color: #c49619;">)</span> <span style="color: #93a61a;">"elements"</span> 'POST<span style="color: #3c98e0;">)</span><span style="color: #93a61a;">)</span><span style="color: #db5823;">)</span>
|
(<span style="font-weight: bold;">let</span> ((result (send-with-session instance `((using . ,strategy) (value . ,selector)) <span style="font-style: italic;">"elements"</span> 'POST)))
|
||||||
<span style="color: #db5823;">(</span><span style="color: #93a61a; font-weight: bold;">map</span>
|
(<span style="font-weight: bold;">map</span>
|
||||||
<span style="color: #93a61a;">(</span><span style="color: #93a61a; font-weight: bold;">lambda</span> <span style="color: #3c98e0;">(</span>elem<span style="color: #3c98e0;">)</span>
|
(<span style="font-weight: bold;">lambda</span> (elem)
|
||||||
<span style="color: #3c98e0;">(</span>make <span style="color: #c49619; font-style: italic;"><WDElement></span> 'driver instance 'element <span style="color: #c49619;">(</span>car <span style="color: #db5823;">(</span>alist-values elem<span style="color: #db5823;">)</span><span style="color: #c49619;">)</span><span style="color: #3c98e0;">)</span><span style="color: #93a61a;">)</span>
|
(make <span style="font-weight: bold; text-decoration: underline;"><WDElement></span> 'driver instance 'element (car (alist-values elem))))
|
||||||
result<span style="color: #db5823;">)</span><span style="color: #c49619;">)</span><span style="color: #3c98e0;">)</span>
|
result)))
|
||||||
</pre>
|
</pre>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="org-src-container">
|
<div class="org-src-container">
|
||||||
<pre class="src src-scheme"><span style="color: #3c98e0;">(</span><span style="color: #93a61a; font-weight: bold;">define-method</span> <span style="color: #c49619;">(</span><span style="color: #3c98e0;">find-element</span> <span style="color: #db5823;">(</span>instance <span style="color: #c49619; font-style: italic;"><WDElement></span><span style="color: #db5823;">)</span> strategy selector<span style="color: #c49619;">)</span>
|
<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="color: #c49619;">(</span><span style="color: #93a61a; font-weight: bold;">let</span> <span style="color: #db5823;">(</span><span style="color: #93a61a;">(</span>result <span style="color: #3c98e0;">(</span>send-with-session instance `<span style="color: #c49619;">(</span><span style="color: #db5823;">(</span>using . ,strategy<span style="color: #db5823;">)</span> <span style="color: #db5823;">(</span>value . ,selector<span style="color: #db5823;">)</span><span style="color: #c49619;">)</span> <span style="color: #93a61a;">"element"</span> 'POST<span style="color: #3c98e0;">)</span><span style="color: #93a61a;">)</span><span style="color: #db5823;">)</span>
|
(<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="color: #db5823;">(</span>make <span style="color: #c49619; font-style: italic;"><WDElement></span> 'driver <span style="color: #93a61a;">(</span>slot-value instance 'driver<span style="color: #93a61a;">)</span> 'element <span style="color: #93a61a;">(</span>car <span style="color: #3c98e0;">(</span>alist-values result<span style="color: #3c98e0;">)</span><span style="color: #93a61a;">)</span><span style="color: #db5823;">)</span>
|
(make <span style="font-weight: bold; text-decoration: underline;"><WDElement></span> 'driver (slot-value instance 'driver) 'element (car (alist-values result)))
|
||||||
element<span style="color: #c49619;">)</span><span style="color: #3c98e0;">)</span>
|
element))
|
||||||
</pre>
|
</pre>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="org-src-container">
|
<div class="org-src-container">
|
||||||
<pre class="src src-scheme"><span style="color: #3c98e0;">(</span><span style="color: #93a61a; font-weight: bold;">define-method</span> <span style="color: #c49619;">(</span><span style="color: #3c98e0;">find-elements</span> <span style="color: #db5823;">(</span>instance <span style="color: #c49619; font-style: italic;"><WDElement></span><span style="color: #db5823;">)</span> strategy selector<span style="color: #c49619;">)</span>
|
<pre class="src src-scheme">(<span style="font-weight: bold;">define-method</span> (<span style="font-weight: bold;">find-elements</span> (instance <span style="font-weight: bold; text-decoration: underline;"><WDElement></span>) strategy selector)
|
||||||
<span style="color: #c49619;">(</span><span style="color: #93a61a; font-weight: bold;">let</span> <span style="color: #db5823;">(</span><span style="color: #93a61a;">(</span>result <span style="color: #3c98e0;">(</span>send-with-session instance `<span style="color: #c49619;">(</span><span style="color: #db5823;">(</span>using . ,strategy<span style="color: #db5823;">)</span> <span style="color: #db5823;">(</span>value . ,selector<span style="color: #db5823;">)</span><span style="color: #c49619;">)</span> <span style="color: #93a61a;">"elements"</span> 'POST<span style="color: #3c98e0;">)</span><span style="color: #93a61a;">)</span><span style="color: #db5823;">)</span>
|
(<span style="font-weight: bold;">let</span> ((result (send-with-session instance `((using . ,strategy) (value . ,selector)) <span style="font-style: italic;">"elements"</span> 'POST)))
|
||||||
<span style="color: #db5823;">(</span><span style="color: #93a61a; font-weight: bold;">map</span>
|
(<span style="font-weight: bold;">map</span>
|
||||||
<span style="color: #93a61a;">(</span><span style="color: #93a61a; font-weight: bold;">lambda</span> <span style="color: #3c98e0;">(</span>elem<span style="color: #3c98e0;">)</span>
|
(<span style="font-weight: bold;">lambda</span> (elem)
|
||||||
<span style="color: #3c98e0;">(</span>make <span style="color: #c49619; font-style: italic;"><WDElement></span> 'driver <span style="color: #c49619;">(</span>slot-value instance 'driver<span style="color: #c49619;">)</span> 'element <span style="color: #c49619;">(</span>car <span style="color: #db5823;">(</span>alist-values elem<span style="color: #db5823;">)</span><span style="color: #c49619;">)</span><span style="color: #3c98e0;">)</span><span style="color: #93a61a;">)</span>
|
(make <span style="font-weight: bold; text-decoration: underline;"><WDElement></span> 'driver (slot-value instance 'driver) 'element (car (alist-values elem))))
|
||||||
result<span style="color: #db5823;">)</span><span style="color: #c49619;">)</span><span style="color: #3c98e0;">)</span>
|
result)))
|
||||||
</pre>
|
</pre>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -859,99 +855,177 @@ The following timeouts are defined:
|
||||||
</ol>
|
</ol>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="outline-container-org25c6507" class="outline-4">
|
<div id="outline-container-org1ee7ac0" class="outline-4">
|
||||||
<h4 id="org25c6507"><span class="section-number-4">4.5.3.</span> Working with Elements</h4>
|
<h4 id="org1ee7ac0"><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="color: #3c98e0;">(</span><span style="color: #93a61a; font-weight: bold;">define-method</span> <span style="color: #c49619;">(</span><span style="color: #3c98e0;">attribute</span> <span style="color: #db5823;">(</span>instance <span style="color: #c49619; font-style: italic;"><WDElement></span><span style="color: #db5823;">)</span> attribute<span style="color: #c49619;">)</span>
|
<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)
|
||||||
<span style="color: #c49619;">(</span><span style="color: #93a61a; font-weight: bold;">let</span> <span style="color: #db5823;">(</span><span style="color: #93a61a;">(</span>result <span style="color: #3c98e0;">(</span>send-with-session instance #f
|
(<span style="font-weight: bold;">let</span> ((result (send-with-session instance #f
|
||||||
<span style="color: #c49619;">(</span>string-append <span style="color: #93a61a;">"attribute/"</span> attribute<span style="color: #c49619;">)</span>
|
(string-append <span style="font-style: italic;">"attribute/"</span> attribute)
|
||||||
'GET<span style="color: #3c98e0;">)</span><span style="color: #93a61a;">)</span><span style="color: #db5823;">)</span>
|
'GET)))
|
||||||
<span style="color: #db5823;">(</span><span style="color: #93a61a; font-weight: bold;">if</span> <span style="color: #93a61a;">(</span>equal? <span style="color: #93a61a;">"true"</span> result<span style="color: #93a61a;">)</span>
|
(<span style="font-weight: bold;">if</span> (equal? <span style="font-style: italic;">"true"</span> result)
|
||||||
#t
|
#t
|
||||||
result<span style="color: #db5823;">)</span><span style="color: #c49619;">)</span><span style="color: #3c98e0;">)</span>
|
result)))
|
||||||
</pre>
|
</pre>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="org-src-container">
|
<div class="org-src-container">
|
||||||
<pre class="src src-scheme"><span style="color: #3c98e0;">(</span><span style="color: #93a61a; font-weight: bold;">define-method</span> <span style="color: #c49619;">(</span><span style="color: #3c98e0;">property</span> <span style="color: #db5823;">(</span>instance <span style="color: #c49619; font-style: italic;"><WDElement></span><span style="color: #db5823;">)</span> property<span style="color: #c49619;">)</span>
|
<pre class="src src-scheme">(<span style="font-weight: bold;">define-method</span> (<span style="font-weight: bold;">property</span> (instance <span style="font-weight: bold; text-decoration: underline;"><WDElement></span>) property)
|
||||||
<span style="color: #c49619;">(</span>send-with-session instance #f <span style="color: #db5823;">(</span>string-append <span style="color: #93a61a;">"property/"</span> property<span style="color: #db5823;">)</span> 'GET<span style="color: #c49619;">)</span><span style="color: #3c98e0;">)</span>
|
(send-with-session instance #f (string-append <span style="font-style: italic;">"property/"</span> property) 'GET))
|
||||||
</pre>
|
</pre>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="org-src-container">
|
<div class="org-src-container">
|
||||||
<pre class="src src-scheme"><span style="color: #3c98e0;">(</span><span style="color: #93a61a; font-weight: bold;">define-method</span> <span style="color: #c49619;">(</span><span style="color: #3c98e0;">clear</span> <span style="color: #db5823;">(</span>instance <span style="color: #c49619; font-style: italic;"><WDElement></span><span style="color: #db5823;">)</span><span style="color: #c49619;">)</span>
|
<pre class="src src-scheme">(<span style="font-weight: bold;">define-method</span> (<span style="font-weight: bold;">clear</span> (instance <span style="font-weight: bold; text-decoration: underline;"><WDElement></span>))
|
||||||
<span style="color: #c49619;">(</span>send-with-session instance #f <span style="color: #93a61a;">"clear"</span> 'POST<span style="color: #c49619;">)</span><span style="color: #3c98e0;">)</span>
|
(send-with-session instance #f <span style="font-style: italic;">"clear"</span> 'POST))
|
||||||
</pre>
|
</pre>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="org-src-container">
|
<div class="org-src-container">
|
||||||
<pre class="src src-scheme"><span style="color: #3c98e0;">(</span><span style="color: #93a61a; font-weight: bold;">define-method</span> <span style="color: #c49619;">(</span><span style="color: #3c98e0;">click</span> <span style="color: #db5823;">(</span>instance <span style="color: #c49619; font-style: italic;"><WDElement></span><span style="color: #db5823;">)</span><span style="color: #c49619;">)</span>
|
<pre class="src src-scheme">(<span style="font-weight: bold;">define-method</span> (<span style="font-weight: bold;">click</span> (instance <span style="font-weight: bold; text-decoration: underline;"><WDElement></span>))
|
||||||
<span style="color: #c49619;">(</span>send-with-session instance #f <span style="color: #93a61a;">"click"</span> 'POST<span style="color: #c49619;">)</span><span style="color: #3c98e0;">)</span>
|
(send-with-session instance #f <span style="font-style: italic;">"click"</span> 'POST))
|
||||||
</pre>
|
</pre>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="org-src-container">
|
<div class="org-src-container">
|
||||||
<pre class="src src-scheme"><span style="color: #3c98e0;">(</span><span style="color: #93a61a; font-weight: bold;">define-method</span> <span style="color: #c49619;">(</span><span style="color: #3c98e0;">computed-label</span> <span style="color: #db5823;">(</span>instance <span style="color: #c49619; font-style: italic;"><WDElement></span><span style="color: #db5823;">)</span><span style="color: #c49619;">)</span>
|
<pre class="src src-scheme">(<span style="font-weight: bold;">define-method</span> (<span style="font-weight: bold;">computed-label</span> (instance <span style="font-weight: bold; text-decoration: underline;"><WDElement></span>))
|
||||||
<span style="color: #c49619;">(</span>send-with-session instance #f <span style="color: #93a61a;">"computedlabel"</span> 'GET<span style="color: #c49619;">)</span><span style="color: #3c98e0;">)</span>
|
(send-with-session instance #f <span style="font-style: italic;">"computedlabel"</span> 'GET))
|
||||||
</pre>
|
</pre>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="org-src-container">
|
<div class="org-src-container">
|
||||||
<pre class="src src-scheme"><span style="color: #3c98e0;">(</span><span style="color: #93a61a; font-weight: bold;">define-method</span> <span style="color: #c49619;">(</span><span style="color: #3c98e0;">computed-role</span> <span style="color: #db5823;">(</span>instance <span style="color: #c49619; font-style: italic;"><WDElement></span><span style="color: #db5823;">)</span><span style="color: #c49619;">)</span>
|
<pre class="src src-scheme">(<span style="font-weight: bold;">define-method</span> (<span style="font-weight: bold;">computed-role</span> (instance <span style="font-weight: bold; text-decoration: underline;"><WDElement></span>))
|
||||||
<span style="color: #c49619;">(</span>send-with-session instance #f <span style="color: #93a61a;">"computedrole"</span> 'GET<span style="color: #c49619;">)</span><span style="color: #3c98e0;">)</span>
|
(send-with-session instance #f <span style="font-style: italic;">"computedrole"</span> 'GET))
|
||||||
</pre>
|
</pre>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="org-src-container">
|
<div class="org-src-container">
|
||||||
<pre class="src src-scheme"><span style="color: #3c98e0;">(</span><span style="color: #93a61a; font-weight: bold;">define-method</span> <span style="color: #c49619;">(</span><span style="color: #3c98e0;">enabled?</span> <span style="color: #db5823;">(</span>instance <span style="color: #c49619; font-style: italic;"><WDElement></span><span style="color: #db5823;">)</span><span style="color: #c49619;">)</span>
|
<pre class="src src-scheme">(<span style="font-weight: bold;">define-method</span> (<span style="font-weight: bold;">enabled?</span> (instance <span style="font-weight: bold; text-decoration: underline;"><WDElement></span>))
|
||||||
<span style="color: #c49619;">(</span>send-with-session instance #f <span style="color: #93a61a;">"enabled"</span> 'GET<span style="color: #c49619;">)</span><span style="color: #3c98e0;">)</span>
|
(send-with-session instance #f <span style="font-style: italic;">"enabled"</span> 'GET))
|
||||||
</pre>
|
</pre>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="org-src-container">
|
<div class="org-src-container">
|
||||||
<pre class="src src-scheme"><span style="color: #3c98e0;">(</span><span style="color: #93a61a; font-weight: bold;">define-method</span> <span style="color: #c49619;">(</span><span style="color: #3c98e0;">selected?</span> <span style="color: #db5823;">(</span>instance <span style="color: #c49619; font-style: italic;"><WDElement></span><span style="color: #db5823;">)</span><span style="color: #c49619;">)</span>
|
<pre class="src src-scheme">(<span style="font-weight: bold;">define-method</span> (<span style="font-weight: bold;">selected?</span> (instance <span style="font-weight: bold; text-decoration: underline;"><WDElement></span>))
|
||||||
<span style="color: #c49619;">(</span>send-with-session instance #f <span style="color: #93a61a;">"selected"</span> 'GET<span style="color: #c49619;">)</span><span style="color: #3c98e0;">)</span>
|
(send-with-session instance #f <span style="font-style: italic;">"selected"</span> 'GET))
|
||||||
</pre>
|
</pre>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="org-src-container">
|
<div class="org-src-container">
|
||||||
<pre class="src src-scheme"><span style="color: #3c98e0;">(</span><span style="color: #93a61a; font-weight: bold;">define-method</span> <span style="color: #c49619;">(</span><span style="color: #3c98e0;">name</span> <span style="color: #db5823;">(</span>instance <span style="color: #c49619; font-style: italic;"><WDElement></span><span style="color: #db5823;">)</span><span style="color: #c49619;">)</span>
|
<pre class="src src-scheme">(<span style="font-weight: bold;">define-method</span> (<span style="font-weight: bold;">name</span> (instance <span style="font-weight: bold; text-decoration: underline;"><WDElement></span>))
|
||||||
<span style="color: #c49619;">(</span>send-with-session instance #f <span style="color: #93a61a;">"name"</span> 'GET<span style="color: #c49619;">)</span><span style="color: #3c98e0;">)</span>
|
(send-with-session instance #f <span style="font-style: italic;">"name"</span> 'GET))
|
||||||
</pre>
|
</pre>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="org-src-container">
|
<div class="org-src-container">
|
||||||
<pre class="src src-scheme"><span style="color: #3c98e0;">(</span><span style="color: #93a61a; font-weight: bold;">define-method</span> <span style="color: #c49619;">(</span><span style="color: #3c98e0;">rect</span> <span style="color: #db5823;">(</span>instance <span style="color: #c49619; font-style: italic;"><WDElement></span><span style="color: #db5823;">)</span><span style="color: #c49619;">)</span>
|
<pre class="src src-scheme">(<span style="font-weight: bold;">define-method</span> (<span style="font-weight: bold;">rect</span> (instance <span style="font-weight: bold; text-decoration: underline;"><WDElement></span>))
|
||||||
<span style="color: #c49619;">(</span>send-with-session instance #f <span style="color: #93a61a;">"rect"</span> 'GET<span style="color: #c49619;">)</span><span style="color: #3c98e0;">)</span>
|
(send-with-session instance #f <span style="font-style: italic;">"rect"</span> 'GET))
|
||||||
</pre>
|
</pre>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="org-src-container">
|
<div class="org-src-container">
|
||||||
<pre class="src src-scheme"><span style="color: #3c98e0;">(</span><span style="color: #93a61a; font-weight: bold;">define-method</span> <span style="color: #c49619;">(</span><span style="color: #3c98e0;">screenshot</span> <span style="color: #db5823;">(</span>instance <span style="color: #c49619; font-style: italic;"><WDElement></span><span style="color: #db5823;">)</span><span style="color: #c49619;">)</span>
|
<pre class="src src-scheme">(<span style="font-weight: bold;">define-method</span> (<span style="font-weight: bold;">screenshot</span> (instance <span style="font-weight: bold; text-decoration: underline;"><WDElement></span>))
|
||||||
<span style="color: #c49619;">(</span>base64-decode <span style="color: #db5823;">(</span>send-with-session instance #f <span style="color: #93a61a;">"screenshot"</span> 'GET<span style="color: #db5823;">)</span><span style="color: #c49619;">)</span><span style="color: #3c98e0;">)</span>
|
(base64-decode (send-with-session instance #f <span style="font-style: italic;">"screenshot"</span> 'GET)))
|
||||||
</pre>
|
</pre>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="org-src-container">
|
<div class="org-src-container">
|
||||||
<pre class="src src-scheme"><span style="color: #3c98e0;">(</span><span style="color: #93a61a; font-weight: bold;">define-method</span> <span style="color: #c49619;">(</span><span style="color: #3c98e0;">text</span> <span style="color: #db5823;">(</span>instance <span style="color: #c49619; font-style: italic;"><WDElement></span><span style="color: #db5823;">)</span><span style="color: #c49619;">)</span>
|
<pre class="src src-scheme">(<span style="font-weight: bold;">define-method</span> (<span style="font-weight: bold;">text</span> (instance <span style="font-weight: bold; text-decoration: underline;"><WDElement></span>))
|
||||||
<span style="color: #c49619;">(</span>send-with-session instance #f <span style="color: #93a61a;">"text"</span> 'GET<span style="color: #c49619;">)</span><span style="color: #3c98e0;">)</span>
|
(send-with-session instance #f <span style="font-style: italic;">"text"</span> 'GET))
|
||||||
</pre>
|
</pre>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="org-src-container">
|
<div class="org-src-container">
|
||||||
<pre class="src src-scheme"><span style="color: #3c98e0;">(</span><span style="color: #93a61a; font-weight: bold;">define-method</span> <span style="color: #c49619;">(</span><span style="color: #3c98e0;">set-value</span> <span style="color: #db5823;">(</span>instance <span style="color: #c49619; font-style: italic;"><WDElement></span><span style="color: #db5823;">)</span> value<span style="color: #c49619;">)</span>
|
<pre class="src src-scheme">(<span style="font-weight: bold;">define-method</span> (<span style="font-weight: bold;">set-value</span> (instance <span style="font-weight: bold; text-decoration: underline;"><WDElement></span>) value)
|
||||||
<span style="color: #c49619;">(</span>send-with-session instance `<span style="color: #db5823;">(</span><span style="color: #93a61a;">(</span>text . ,value<span style="color: #93a61a;">)</span><span style="color: #db5823;">)</span> <span style="color: #93a61a;">"value"</span> 'POST<span style="color: #c49619;">)</span><span style="color: #3c98e0;">)</span>
|
(send-with-session instance `((text . ,value)) <span style="font-style: italic;">"value"</span> 'POST))
|
||||||
</pre>
|
</pre>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div id="outline-container-org86b4a66" class="outline-2">
|
||||||
|
<h2 id="org86b4a66"><span class="section-number-2">5.</span> About This Egg</h2>
|
||||||
|
<div class="outline-text-2" id="text-5">
|
||||||
|
</div>
|
||||||
|
<div id="outline-container-orgac72f6e" class="outline-3">
|
||||||
|
<h3 id="orgac72f6e"><span class="section-number-3">5.1.</span> Source</h3>
|
||||||
|
<div class="outline-text-3" id="text-5-1">
|
||||||
|
<p>
|
||||||
|
The source is available at <a href="https://fossil.lyrion.ch/chicken-webdriver">https://fossil.lyrion.ch/chicken-webdriver</a>.
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="outline-container-orgd19a870" class="outline-3">
|
||||||
|
<h3 id="orgd19a870"><span class="section-number-3">5.2.</span> Author</h3>
|
||||||
|
<div class="outline-text-3" id="text-5-2">
|
||||||
|
<p>
|
||||||
|
Daniel Ziltener
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="outline-container-orgc04d23c" class="outline-3">
|
||||||
|
<h3 id="orgc04d23c"><span class="section-number-3">5.3.</span> Version History</h3>
|
||||||
|
<div class="outline-text-3" id="text-5-3">
|
||||||
|
<table id="org3b5abd1" border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">
|
||||||
|
|
||||||
|
|
||||||
|
<colgroup>
|
||||||
|
<col class="org-right" />
|
||||||
|
|
||||||
|
<col class="org-left" />
|
||||||
|
</colgroup>
|
||||||
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<td class="org-right">0.5</td>
|
||||||
|
<td class="org-left">Initial Release</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="outline-container-org9889d78" class="outline-3">
|
||||||
|
<h3 id="org9889d78"><span class="section-number-3">5.4.</span> License</h3>
|
||||||
|
<div class="outline-text-3" id="text-5-4">
|
||||||
|
<div class="org-src-container">
|
||||||
|
<pre class="src src-fundamental">Copyright (C) 2023 Daniel Ziltener
|
||||||
|
|
||||||
|
All rights reserved.
|
||||||
|
|
||||||
|
Redistribution and use in source and binary forms, with or without
|
||||||
|
modification, are permitted provided that the following conditions are met:
|
||||||
|
* Redistributions of source code must retain the above copyright
|
||||||
|
notice, this list of conditions and the following disclaimer.
|
||||||
|
* Redistributions in binary form must reproduce the above copyright
|
||||||
|
notice, this list of conditions and the following disclaimer in the
|
||||||
|
documentation and/or other materials provided with the distribution.
|
||||||
|
* Neither the name of the <organization> nor the
|
||||||
|
names of its contributors may be used to endorse or promote products
|
||||||
|
derived from this software without specific prior written permission.
|
||||||
|
|
||||||
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||||
|
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
|
||||||
|
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
|
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
|
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
|
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
|
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
</pre>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</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 16:13</p>
|
<p class="date">Created: 2023-04-13 Do 16:54</p>
|
||||||
|
<p class="validation"><a href="https://validator.w3.org/check?uri=referer">Validate</a></p>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</body>
|
|
||||||
</html>
|
|
|
@ -622,7 +622,7 @@ Daniel Ziltener
|
||||||
#+begin_src scheme :noweb yes :tangle webdriver.release-info :exports none
|
#+begin_src scheme :noweb yes :tangle webdriver.release-info :exports none
|
||||||
;; -*- scheme -*-
|
;; -*- scheme -*-
|
||||||
(repo fossil "https://fossil.lyrion.ch/chicken-webdriver")
|
(repo fossil "https://fossil.lyrion.ch/chicken-webdriver")
|
||||||
(uri targz "https://fossil.lyrion.ch/chicken-webdriver")
|
(uri targz "https://fossil.lyrion.ch/chicken-webdriver/tarball/{egg-release}/chicken-webdriver-{egg-release}.tar.gz")
|
||||||
<<gen-releases()>>
|
<<gen-releases()>>
|
||||||
#+end_src
|
#+end_src
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
;; [[file:webdriver.org::*Version History / Repository][Version History / Repository:3]]
|
;; [[file:webdriver.org::*Version History][Version History:3]]
|
||||||
;; -*- scheme -*-
|
;; -*- scheme -*-
|
||||||
(repo fossil "https://fossil.lyrion.ch/chicken-webdriver")
|
(repo fossil "https://fossil.lyrion.ch/chicken-webdriver")
|
||||||
(uri targz "https://fossil.lyrion.ch/chicken-webdriver")
|
(uri targz "https://fossil.lyrion.ch/chicken-webdriver/tarball/{egg-release}/chicken-webdriver-{egg-release}.tar.gz")
|
||||||
(release "0.5") ;; Initial Release
|
(release "0.5") ;; Initial Release
|
||||||
;; Version History / Repository:3 ends here
|
;; Version History:3 ends here
|
||||||
|
|
Loading…
Reference in a new issue