I'm using the latest version of Selenium and the chromedriver
to test a ZK application.
During the test, I'd like to dump the DOM (or part of it) to help me find the elements I need (and probably help people who have to maintain the test).
The method WebDriver.getPageSource()
looked promising but it only returns the HTML as it was sent by the server, not the result after running all the JavaScript code.
The JavaScript code is run; I can find elements by ID that I can't see in the output of getPageSource()
. So I tried WebElement.getText()
but that is only the text of the elements, not the elements themselves or their attributes.
Is it possible at all to get the DOM or do I have to do keyhole surgery here?
I have the same question really but the only way I've found to do it is ExecuteScript:
why the By doesnt support By.DOM with a function I don't really know...I suspect its due to the need for a webdriver for multiple browsers etc