Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use unwrap-webdriver-object #632

Merged
merged 1 commit into from
Aug 17, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 9 additions & 10 deletions src/etaoin/api.clj
Original file line number Diff line number Diff line change
Expand Up @@ -534,8 +534,7 @@
:path [:session (:session driver) :element]
:data {:using locator :value term}})
:value
first
second))
(unwrap-webdriver-object web-element-identifier)))

(defn ^:no-doc find-elements*
[driver locator term]
Expand All @@ -544,7 +543,7 @@
:path [:session (:session driver) :elements]
:data {:using locator :value term}})
:value
(mapv (comp second first))))
(mapv #(unwrap-webdriver-object % web-element-identifier))))

(defn- find-element-from*
[driver el locator term]
Expand All @@ -554,8 +553,7 @@
:path [:session (:session driver) :element el :element]
:data {:using locator :value term}})
:value
first
second))
(unwrap-webdriver-object web-element-identifier)))

(defn- find-elements-from*
[driver el locator term]
Expand All @@ -565,7 +563,7 @@
:path [:session (:session driver) :element el :elements]
:data {:using locator :value term}})
:value
(mapv (comp second first))))
(mapv #(unwrap-webdriver-object % web-element-identifier))))

(defn- follow-path-from-element*
"Starting at `el`, search for the first query in `path`, then from the
Expand Down Expand Up @@ -1476,7 +1474,7 @@
(defmethod get-element-shadow-root*
:safari
[driver el]
;; Safari gives us the shadow root in a non-standard wrapper
;; As of Aug 2024, Safari gives us the shadow root in a non-standard wrapper
(when-let [root (get-element-property-el driver el "shadowRoot")]
(-> root first second)))

Expand Down Expand Up @@ -1688,10 +1686,11 @@
(defn el->ref
"Return map representing an element reference for WebDriver.

The magic `:element-` constant in source is taken from the [WebDriver Spec](https://www.w3.org/TR/webdriver2/#elements).
The magic `web-element-identifier` constant in the source is
taken from the [WebDriver Spec](https://www.w3.org/TR/webdriver2/#elements).

Passing the element reference map to `js-execute` automatically expands it
into a DOM node. For example:
Passing the element reference map to `js-execute` automatically
expands it into a DOM node. For example:

```Clojure
;; returns UUID string for the element
Expand Down
Loading