0

I'm using the FluentAutomation version of Selenium, and I can't find any way to get the HTML of an element. I can get the text and attributes, but there doesn't seem to be any way to get the full HTML content, which I need for a certain kind of test I'm doing.

Is there any way to do this?

Joshua Frank
  • 13,120
  • 11
  • 46
  • 95
  • 1
    Possible duplicate of [Get HTML Source of WebElement in Selenium WebDriver using Python](http://stackoverflow.com/questions/7263824/get-html-source-of-webelement-in-selenium-webdriver-using-python) – Marek Apr 15 '16 at 11:56

2 Answers2

4

Assuming you mean the innerHTML or the outerHTML, you should just be able to call GetAttribute on the element, or whatever it is in your language.

Example C#:

element.GetAttribute("innerHTML");

Example Ruby:

element.attribute('innerHTML')
Arran
  • 24,648
  • 6
  • 68
  • 78
-1

I am not sure if a straight-forward way exists, anyway, it should be possible to execute something similar to:

((JavascriptExecutor)driver).executeScript("return arguments[0].innerHTML;", element);
Erki M.
  • 5,022
  • 1
  • 48
  • 74