Dumping Navigator HTML

24 views
Skip to first unread message

Trey Turner

unread,
Dec 13, 2019, 2:27:26 PM12/13/19
to Geb User Mailing List
Hi Gebbers,
I would very much like to be able to see or print the HTML scope represented by a navigator for debugging purposes. I'm looking for something like driver.getPageSource(), but that only returns the selected and downstream content. I haven't been able to find anything in the docs or on Google or StackOverflow. Is this possible? I've even drilled into Navigators in IDEA's debugger but haven't found anything like this yet.

Regards,
Trey

Alexander Kriegisch

unread,
Dec 14, 2019, 9:18:44 PM12/14/19
to geb-...@googlegroups.com
myNavigator.getAttribute("outerHTML")


--
Alexander Kriegisch
https://scrum-master.de

Alexander Kriegisch

unread,
Dec 14, 2019, 9:44:28 PM12/14/19
to geb-...@googlegroups.com
Sorry, maybe with some more context:


<ul id="countries">
<li title="DE">Germany</a></li>
<li title="US">USA</a></li>
<li title="IT">Italy</a></li>
<li title="TH">Thailand</a></li>
</ul>


def "Access navigator HTML"() {
when:
to MySamplePage
def countryList = $("#countries")

then:
countryList.attr("outerHTML").startsWith('<ul id="countries">')
countryList.attr("innerHTML").trim().startsWith('<li title="DE">Germany</li>')
}


--
Alexander Kriegisch
https://scrum-master.de


Alexander Kriegisch schrieb am 15.12.2019 09:18 (GMT +07:00):

> myNavigator.getAttribute("outerHTML")

Trey Turner

unread,
Dec 14, 2019, 11:17:29 PM12/14/19
to geb-...@googlegroups.com
Beautiful, thanks Alexander!

--
You received this message because you are subscribed to a topic in the Google Groups "Geb User Mailing List" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/geb-user/jWt9F5r74uo/unsubscribe.
To unsubscribe from this group and all its topics, send an email to geb-user+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/geb-user/20191215024426.7BC5C44C07E7%40dd39516.kasserver.com.
Reply all
Reply to author
Forward
0 new messages