etaoin 2023-05-01

I have an element that i got through a query, how do i use that element to start a new query? (just like element.querySelector)

(execute {:driver driver
                :method :post
                :path   [:session (:session driver) :element el :element]
                :data   {:using locator :value term}})
i found this while looking through the codebase, is this how i'm supposed to run a query against an el?

oh, maybe i'm supposed to use the child or children function

not obvious that those would be query functions from their names

Ya I think so @pppaul, there is an example usage under https://cljdoc.org/d/etaoin/etaoin/1.0.40/doc/user-guide#_getting_started:

;; Ok,now let's try something trickier
;; Maybe we are interested what value the infobox holds for the Family row:
(let [wikitable (e/query driver {:css "table.infobox.vevent tbody"})
      row-els (e/children driver wikitable {:tag :tr})]
  (for [row row-els
        :let [header-col-text (e/with-http-error
                                (e/get-element-text-el driver
                                                       (e/child driver row {:tag :th})))]
        :when (= "Family" header-col-text)]
    (e/get-element-text-el driver (e/child driver row {:tag :td}))))

yeah, i think i was expecting something like query-child

Yeah agree, not terribly obvious naming there. We could rename and deprecate current. Maybe query-for-child and query-for-children? Another one I find a bit odd is wait-has-text-everywhere which I think would be better named wait-has-text-anywhere.