Fork me on GitHub
#etaoin
<
2023-05-01
>
pppaul22:05:18

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)

pppaul22:05:41

(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?

pppaul22:05:24

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

pppaul22:05:49

not obvious that those would be query functions from their names

lread23:05:46

Ya I think so @U0LAJQLQ1, 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}))))

pppaul00:05:52

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

lread03:05:41

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.