D
D
densaface2015-06-18 22:27:40
Java
densaface, 2015-06-18 22:27:40

How to extract the html code of a page from the DefaultElement class?

In a Java project using selenium and maven to manage an html page, I can’t understand why a certain locator is not found under certain conditions. For debugging, I want to get the source html code of the page, save it, so that later I can understand what's going on. I tried using
screen.getDocument().asXML()
where screen is an instance of the DefaultElement class
dom4j.sourceforge.net/dom4j-1.6.1/apidocs/org/dom4...
but judging by the description and what I get, it's not exactly html code, albeit something similar.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
E
Evgeny Tkachenko, 2015-06-19
@densaface

1. Debug is not an option, put a breakpoint in front of the place where it crashes and manually debug.
2. The locator can again be found with handles in Chrome Dev. tools
3. If you stupidly need the entire html code of the current window, then stupidly output an instance of your webdriver, it will dump the entire DOM for you

A
Alexander, 2015-06-19
@Papagatto

FindElement(By.TagName("body")).GetAttribute("innerHTML") won't work?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question