SeleniumHQ / selenium-google-code-issue-archive

Archive, please see main selenium repo
https://github.com/seleniumhq/selenium
345 stars 195 forks source link

[SafariDriver] The SafariDriver only takes screenshots of the visible viewport. #3752

Open lukeis opened 8 years ago

lukeis commented 8 years ago

Originally reported on Google Code with ID 3752

The SafariDriver only supports returning a screenshot of the visible viewport.[1]  Find
a way to support generating screenshots of the entire DOM. Ideally, we'd do this without
resizing the window.

[1] http://developer.apple.com/library/safari/#documentation/UserExperience/Reference/SBrowserTabClassReference/SafariBrowserTab.html#//apple_ref/doc/uid/TP40009793

Reported by jmleyba on 2012-04-19 12:21:34

lukeis commented 8 years ago

Reported by jmleyba on 2012-04-19 22:08:40

lukeis commented 8 years ago
any workaround for this issue?

Reported by sakesan@v6hp.in.th on 2013-03-12 14:58:07

lukeis commented 8 years ago
You can use the WebDriver.Window interface to adjust the size of the window so more
of the page is captured in the viewport.

http://selenium.googlecode.com/git/docs/api/java/org/openqa/selenium/WebDriver.Window.html

Reported by jmleyba on 2013-03-12 16:30:37

lukeis commented 8 years ago
That is a great idea for a workaround.  One problem: That feature also seems to fail
in Safari!  My experience is with using a remove driver (augmented) through a Selenium
Hub.

    driver.manage().window().setSize(targetSize);

Reported by joeytwiddle on 2013-03-15 08:07:09

lukeis commented 8 years ago
Perhaps that is because browsers no longer like supporting window.resizeTo() on normal
windows.

One workaround, which would be quite difficult, might be to scroll around the page,
taking a number of smaller screenshots, and then patch them all together into one large
image at the end.

Reported by joeytwiddle on 2013-03-19 02:24:52

lukeis commented 8 years ago
It seem cannot "setSize" more than screen resolution, I've try over Mac (Safari 6) and
Windows (safari 5) but the result still exists. @joey suggestion is interesting, I
looking into http://awesomescreenshot.com/ source, they using same solution (capture
& scroll then capture again)

many thanks,

Reported by sakesan@v6hp.in.th on 2013-03-19 08:36:13

lukeis commented 8 years ago
Hi all,
i am still facing the same issue (safari is not able to take screenshot of full page).
I have tried maximizing browser size but its not covering majority of the page and
merging smaller screenshots into one will be a bit time consuming.
any tentative date of resolving this issue ??

Reported by nikhilsharma7610 on 2013-04-30 05:44:37

lukeis commented 8 years ago
Just to be clear, this is *not* a bug, but a feature request.  In terms of priorities
for the SafariDriver, this is pretty much at the bottom of the list for me.  I will
be happy to review any patches though, should someone like to contribute :-)

Reported by jmleyba on 2013-04-30 17:05:50

lukeis commented 8 years ago
Being able to take screenshots of full pages across all browsers would be a huge enhancement
to Selenium.  It would allow us to automate rapid UI feedback to our dev team.

Reported by bclayton@globalcloud.net on 2013-06-05 13:10:12

lukeis commented 8 years ago
Sorry, I don't see how this is not a bug. I can't see many use cases where a partial
screenshot would be helpful, but lots of people including our team rely on being able
to save a screenshot of the *entire* page. This is a showstopper for us.

Reported by alex.kalinovsky@creamtec.com on 2013-09-10 12:45:48

lukeis commented 8 years ago
It still not working on windows platform...as i want to capture objects which is below
the screen...it fails to perform over Safari but working fine over other browsers...the
same issue is with Chrome higher version...should someone like to contribute..

Reported by vijayshgupta on 2013-10-28 15:08:20

lukeis commented 8 years ago
Agreed that this is a bug. Unlike any other browser, I can't get a screenshot of the
whole page in Safari - even scrolling around and stiching together images does not
work, since regardless of where the page is scrolled to, the screenshot returned is
of the viewport size starting at position 0,0 (ie. top left of the current page).

I have successfully worked around many screenshot issues in Chrome and Internet Explorer,
but I can't work around this SafariDriver bug.

Would very much appreciate a fix, this is stopping us delivering fully automated cross-browser
testing to our clients...

Reported by ben.empson on 2013-11-01 13:02:23

lukeis commented 8 years ago

Reported by jmleyba on 2013-11-01 16:44:44

lukeis commented 8 years ago
There is a workaround. It's not pretty, though. :)

All you have to do is set the style of body tag to position: relative and add negative
top margin to viewport height (i.e. window.innerHeight) - increment this with every
iteration. This way you will have scrolling look and feel, but it looks awkward a bit
because the scroll bar doesn't move with the content.

Reported by mlazovic@deployinc.com on 2014-03-07 16:27:31

lukeis commented 8 years ago
Did a patch had been submitted for this ? Is screenshot of full page content to be available
in near future ?

Reported by surendar.t on 2014-07-27 06:42:42

lukeis commented 8 years ago
Any update in this issue? Is someone taking care into this issue? 

Reported by tbryan@ciandt.com on 2015-04-08 21:39:03

lukeis commented 8 years ago
It seems everyone wants the fullscreen screenshot.  But I *want* the viewport screenshot.
 Please don't remove that capability.   The web page(s) that I'm testing change as
they are scrolled and I want to capture intermediate states.  Thanks.

Reported by willjs62 on 2015-06-01 18:51:08

lukeis commented 8 years ago
On comment 19, then a good resolution, assuming implementing full screenshot doesn't
require big changes, would be to offer a new capability parameter for Safari to specify
whether to take a viewport or full screenshot. With default being fullscreen I guess.

Reported by mangaroo on 2015-06-01 19:13:44

lukeis commented 8 years ago

Reported by luke.semerau on 2015-09-17 17:44:49