mozilla / geckodriver

WebDriver for Firefox
https://firefox-source-docs.mozilla.org/testing/geckodriver/
Mozilla Public License 2.0
7.03k stars 1.51k forks source link

How to get the HTML code of an element? #2072

Closed prRZ5F4LXZ closed 1 year ago

prRZ5F4LXZ commented 1 year ago

https://developer.mozilla.org/en-US/docs/Web/WebDriver

I only see commands like the following on the above page. But I don't see a way to get the HTML code of an element.

I tried outerHTML. But it does not seem to be there. Do I miss anything?

$ curl -s -H 'Content-Type: application/json' -d '{"url":"http://httpbin.org"}' http://127.0.0.1:4444/session/91ba315a-d796-440f-8e45-35d384fb1c8a/url
{"value":null}
$ curl -s -H 'Content-Type: application/json' -d '{"using":"xpath","value":"//h2[@class=\"title\"]"}' http://127.0.0.1:4444/session/91ba315a-d796-440f-8e45-35d384fb1c8a/element
{"value":{"element-6066-11e4-a52e-4f735466cecf":"74d674fc-7f39-49ee-9a25-5bbafe6aaff9"}}
$ curl -s http://127.0.0.1:4444/session/91ba315a-d796-440f-8e45-35d384fb1c8a/element/74d674fc-7f39-49ee-9a25-5bbafe6aaff9/attribute/outerHTML
{"value":null}

System

Testcase

Stacktrace

Trace-level log

whimboo commented 1 year ago

As I have said in the other issues please get it in contact via the given communication channel. The issue tracker here is not for support questions but for bug issues and feature requests.

https://chat.mozilla.org/#/room/#webdriver:mozilla.org