Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6999373
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T20:31:58+00:00 2026-05-27T20:31:58+00:00

At Interface TakesScreenshot page I found this: Capture the screenshot and store it in

  • 0

At Interface TakesScreenshot page I found this:

Capture the screenshot and store it in the specified location. For
WebDriver extending TakesScreenshot, this makes a best effort
depending on the browser to return the following in order of
preference: – Entire page – Current window – Visible portion of the
current frame – The screenshot of the entire display containing the
browser

For WebElement extending TakesScreenshot, this makes a best effort
depending on the browser to return the following in order of
preference: – The entire content of the HTML element – The visisble
portion of the HTML element.

So I am wondering it should support capture screenshot of a webelement, but can’t find any document relate to this support by now. not sure if it really supported or not.

anybody know more details about this? Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T20:31:59+00:00Added an answer on May 27, 2026 at 8:31 pm

    The documentation would indicate that it is supported, but in practice, it does not work (at least not with the .Net bindings):

    var screenshotTaker = element as ITakesScreenshot;
    var image = screenshotTaker.GetScreenshot();
    image.SaveAsFile(fileName, ImageFormat.Jpeg); // << null exception thrown here
    

    There is a workaround that has worked for me – execute javascript on the page to get the location of the element:

    const string javascript = "return arguments[0].getBoundingClientRect()";
    var obj = (Dictionary<string, object>)((IJavaScriptExecutor)_core.Driver).ExecuteScript(javascript, element);
    var rect = new Rectangle((int)double.Parse(obj["left"].ToString()),
                             (int)double.Parse(obj["top"].ToString()),
                             (int)double.Parse(obj["width"].ToString()),
                             (int)double.Parse(obj["height"].ToString()));
    

    That will give you the location of the element within the viewport, at which point you can take a screenshot of the entire page and crop it down to just the bounds of the element.

    Hopefully that helps…

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In interface builder I changed the color of a UILabel to this screenshot, having
Is interface an acceptable place to store my public static final Foo bar Do
@interface first : <NSObject> { NSString *myStr; /** I don't understand why declared this
Interface declaration: @interface MusicPlayerViewController : UIViewController I'm currently setting my title like this: NSString*
In Interface Builder (iOS 5/iPad), under Simulated Metrics of a view controller, I found
interface ISample { int Sum(int a,int b); int Multiplication(int x,int a,int b); } class
interface I { int J(); } class A : I { public int J(){return
interface If { ... } class Impl implements If { ... } function test(type:Class,
interface A { void hi(); } class AImpl implements A { public void hi()
interface Addable<E> { public E add(E x); public E sub(E y); public E zero();

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.