diff --git a/README.adoc b/README.adoc index 7144375a..8631651c 100644 --- a/README.adoc +++ b/README.adoc @@ -84,6 +84,7 @@ Can be `alpha`, `beta`, `rc1`, etc. * https://github.com/nebesnytihohod[Maxim Stasenkov] * https://github.com/daveyarwood[Dave Yarwood] * https://github.com/jkrasnay[John Krasnay] +* https://github.com/kidd[Raimon Grau] === Current Maintainers diff --git a/doc/01-user-guide.adoc b/doc/01-user-guide.adoc index 0163e9e0..adf5ca89 100644 --- a/doc/01-user-guide.adoc +++ b/doc/01-user-guide.adoc @@ -272,7 +272,28 @@ endif::[] (e/get-title driver) ;; => "Clojure - Wikipedia" -;; stops Firefox WebDriver +;; let's explore the info box +;; What's its caption? Let's select it with a css query: +(e/get-element-text driver {:css "table.infobox caption"}) +;; => "Clojure" + +;; 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})))) +;; => ("Lisp") + +;; Etaoin gives you many options, we can do the same-ish in one swoop in XPath: +(e/get-element-text driver "//table[@class='infobox vevent']/tbody/tr/th[text()='Family']/../td") +;; => "Lisp" + +;; When we are done we quit, which stops the Firefox WebDriver (e/quit driver) ;; the Firefox Window should close ----