etaoin

2023-05-01T22:44:18.519959Z

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)

2023-05-01T22:48:41.749049Z

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

2023-05-01T22:49:24.558149Z

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

2023-05-01T22:49:49.091939Z

not obvious that those would be query functions from their names

lread 2023-05-01T23:01:46.589039Z

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}))))

2023-05-02T00:22:52.094599Z

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

lread 2023-05-02T03:09:41.614009Z

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.