Antonio
Antonio

Reputation:

Is there a way to get/save the DOM with Selenium?

What I'm looking for is a method that works like "captureScreenshot(String path)", but instead of producing an image is saves the DOM as it currently is. Note that the existing getBodyText() method is not enough.

Upvotes: 2

Views: 1775

Answers (1)

Santi
Santi

Reputation: 4468

What you're looking for is:

getHtmlSource()

It will save all the content as a string in a variable, and then you can parse the dom as you want.

Upvotes: 1

Related Questions