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

fix get-inner-html for phantomjs #266

Merged
merged 1 commit into from
Aug 5, 2020
Merged
Show file tree
Hide file tree
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
15 changes: 13 additions & 2 deletions src/etaoin/api.clj
Original file line number Diff line number Diff line change
Expand Up @@ -1121,15 +1121,26 @@
;;
;; element inner HTML
;;

(defn get-element-inner-html-el
(defmulti get-element-inner-html-el
"Returns element's inner text by its identifier."
dispatch-driver)

(defmethod get-element-inner-html-el
:default
[driver el]
{:pre [(some? el)]}
(:value (execute {:driver driver
:method :get
:path [:session (:session @driver) :element el :property :innerHTML]})))

(defmethod get-element-inner-html-el
:phantom
[driver el]
{:pre [(some? el)]}
(:value (execute {:driver driver
:method :get
:path [:session (:session @driver) :element el :attribute :innerHTML]})))

(defn get-element-inner-html
"Returns element's inner HTML.

Expand Down
5 changes: 5 additions & 0 deletions test/etaoin/api_test.clj
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,11 @@
(= [nil nil nil nil])
is))))

(deftest test-get-inner-html
(let [inner-html "<div>Inner HTML</div>"
result (get-element-inner-html *driver* :element-props)]
(is (= inner-html result))))

(deftest test-title
(doto *driver*
(-> get-title (= "Webdriver Test Document") is)))
Expand Down