selenium icon indicating copy to clipboard operation
selenium copied to clipboard

Take screenshot specifies element in Javascript?

Open vanloc0301 opened this issue 11 years ago • 7 comments

I create test for my webpage in nodejs.

I want to save 1 image in my local website and convert it to base64 and save in mongodb.

I'll research all internet, I find almost is C# and Java code but I can't convert it to Javascript.

Present, my code can Takescreenshot all webpage but I want it capture only 1 element like image with id or class.

Thank you.

vanloc0301 avatar Aug 23 '15 05:08 vanloc0301

most drivers do not yet support element screenshots see #912

but the API should exist in javascript, will leave this bug open to implement that in webdriver.js for the WebElement class.

lukeis avatar Aug 23 '15 17:08 lukeis

Sorry, I don't know. This mean is can't takescreenshot specifies Element in Javascript?

If it can takescreenshot 1 element, you can example in javascript code?

The python different with javascript. Python or other langues in client is get support much javascript.

I'm using node.js. Anyway to capture 1 element? I'm was using WD and PhantomJS but it not success. Because my auto test go in sequence step by step.

Almost other library can do this, but it's not combined with selenium. Because it using other get image, but my image change random in 1 session. If it go to url like selenium image will change.

Thank you.

vanloc0301 avatar Aug 23 '15 18:08 vanloc0301

Can anybody help me? Thank you.

vanloc0301 avatar Aug 25 '15 02:08 vanloc0301

stackoverflow.com is usually a better place for questions. Issues are more for bug reports and feature requests.

zoechi avatar Aug 25 '15 05:08 zoechi

@vanloc0301 This has not been implemented in phantomjs. You will need to raise a bug there for them to implement takes element screenshot.

AutomatedTester avatar Aug 25 '15 07:08 AutomatedTester

You might wan tot try to define the co-ordinates for your element. More details can be found here:

https://groups.google.com/forum/#!topic/selenium-users/7wHF0nGuOV0 https://groups.google.com/forum/?fromgroups=#!searchin/selenium-users/image/selenium-users/8atiPIh39OY/S2NVGiKQbuYJ

Best, Jigyasa 2122888978 https://www.linkedin.com/in/jigyasa1

Forgive Typos. Sent from my S4

On Tue, Aug 25, 2015 at 3:02 AM, David Burns [email protected] wrote:

@vanloc0301 https://github.com/vanloc0301 This has not been implemented in phantomjs. You will need to raise a bug there for them to implement takes element screenshot http://w3c.github.io/webdriver/webdriver-spec.html#take-element-screenshot.

— Reply to this email directly or view it on GitHub https://github.com/SeleniumHQ/selenium/issues/958#issuecomment-134504870 .

jigyasa-at-git avatar Aug 25 '15 14:08 jigyasa-at-git

Thank you very much. @jigyasa-at-git . But almost only support in C#, Python or Java. In javascript is not support select element. @zoechi I was ask in stackoverflow.com but everybody example with C# or Java. @AutomatedTester . Thank for reply.

vanloc0301 avatar Aug 25 '15 17:08 vanloc0301