Screenshot for element is not working from C# binding

By design Issue #3544183

Details

Created
Jul 13, 2015
Privacy
This issue is public.
Reports
Reported by 0 people

Sign in to watch or report this issue.

Steps to reproduce

Run the following C# code:

 

LaunchDriver();

NavigateToUrl(

http://ie-snap/scratchtests/mustjab/WebDriver/TestSnapshot.htm

);

Screenshot

el_screenshot

=

((

RemoteWebElement

)_driver

.

FindElementById(

“image”

))

.

GetScreenshot();

el_screenshot

.

SaveAsFile(

Path

.

Combine(System

.

Environment

.

CurrentDirectory,

“screenshot_element.png”

),

ImageFormat

.

Png);

 

Expected: Only element is captured

Actual: whole page is captured instead

Attachments

0 attachments

    Comments and activity

    • Microsoft Edge Team

      Changed Assigned To to “Jeff L.”

      Changed Assigned To from “Jeff L.” to “Mustapha J.”

      Changed Status to “By design”

      Changed Assigned To from “Mustapha J.” to “John J.”

      Changed Assigned To to “Jeff L.”

      Changed Status from “By design”

      Changed Assigned To from “Jeff L.” to “John J.”

      Changed Status to “Confirmed”

      Changed Title from “Screenshot for element is not working from C# binding” to “Screenshot for element is not working from C# binding”

      Changed Assigned To from “John J.” to “Mustapha J.”

      Changed Assigned To from “Mustapha J.” to “Clay M.”

      Changed Assigned To from “Clay M.” to “Mustapha J.”

      Changed Status from “Confirmed” to “By design”

    • The bindings are calling /session/{session id}/screenshot/{element id}. This isn’t documented in the JSON Wire Protocol or W3C WebDriver Spec as a valid way to get the screenshot. The JSON Wire Protocol only defines screenshot as getting the screenshot of the page as seen here:

      https://github.com/SeleniumHQ/selenium/wiki/JsonWireProtocol#sessionsessionidscreenshot

      The W3C spec specifies that to get an element screenshot you call /session/{session id}/element/{element id}/screenshot as seen here:

      https://www.w3.org/TR/webdriver/#dfn-take-element-screenshot

       If you call the W3C endpoint it works as expected.

    You need to sign in to your Microsoft account to add a comment.

    Sign in