Skip to content

Commit

Permalink
fix get-inner-html for phantomjs (#266)
Browse files Browse the repository at this point in the history
  • Loading branch information
Uunnamed authored Aug 5, 2020
1 parent 6e321fc commit 6029830
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
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

0 comments on commit 6029830

Please sign in to comment.