rshf / chromedriver

Automatically exported from code.google.com/p/chromedriver
2 stars 1 forks source link

ChromeDriver2 take screenshot is not full page #294

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
In version 2 ChromeDriver started making a screenshot is not the whole page, 
but only part of it.
Here is some code (the result in Attach)

-------------------
from pyvirtualdisplay import Display
from selenium import webdriver
from threading import Timer

display = Display(visible=0, size=(1200, 800))
display.start()

chromeOps = webdriver.ChromeOptions()
chromeOps._binary_location = "/usr/bin/google-chrome"

driver = webdriver.Chrome('../chromedriver2', port=4445, 
chrome_options=chromeOps) # Optional argument, if not specified will search 
path. 
driver.get('http://trinixy.ru')
driver.save_screenshot('screenie.png')
driver.quit()
display.stop()
-------------------

ChromeDriver = 2 (r191457)
Chrome = Google Chrome 26.0.1410.43 
OS = Debian and Ubuntu

Original issue reported on code.google.com by jiexa....@gmail.com on 31 Mar 2013 at 8:38

Attachments:

GoogleCodeExporter commented 9 years ago
This is expected. We've had some requests for full page screenshots, but we 
haven't implemented it yet. We could try resizing the window to some huge 
amount, or scrolling and stitching.

The previous way we did things in ChromeDriver1 allowed us to get a full page 
screenshot, but it was not always 100% accurate to what a user saw. The way we 
are doing in ChromeDriver2 should be exactly what the user sees.

Original comment by kkania@chromium.org on 1 Apr 2013 at 3:09

GoogleCodeExporter commented 9 years ago
Thank you for quickly response!
Tell me, please, how can I resize window at 100% in ChromeDriver2 and make 
fullscreen screenshot?

Which way will be better for it?

Original comment by jiexa....@gmail.com on 1 Apr 2013 at 3:27

GoogleCodeExporter commented 9 years ago
You can resize the window with WebDriver. However, we haven't implemented that 
command yet. We will shortly.

Original comment by kkania@chromium.org on 1 Apr 2013 at 3:52

GoogleCodeExporter commented 9 years ago
Looking forward to window resize being implemented!

Original comment by ja...@tyrrells.com on 2 Apr 2013 at 3:44

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
I have not had any problems until a few days ago. I believe it was due to an 
eclipse update I did, is there anyway to revert back to chromedriver1 because 
this behavior has  made all my chromedriver tests worthless. I work for a 
company that creates very large web pages. To only be able to take a screenshot 
of the visible screen is worthless. I cannot believe you would change this 
without at least leaving the option to take the complete screenshot... Thank 
god that sales are the lowest on chrome. 

Original comment by jackcwes...@gmail.com on 31 May 2013 at 4:35

GoogleCodeExporter commented 9 years ago
Hello, we are using the Perl WebDriver bindings. The screenshot used to 
actually grab a full page for us with older versions of Chrome, but now with 
Chrome 27 (Version 27.0.1453.110 m) and chromedriver.exe that is 2,575,872 
bytes in size, only the "visible" portion of the page is captured and the rest 
is black. See the attached file.

With the new chromedriver.exe for Chrome v27 to v29, that is 6,579,712 bytes in 
size, the problem is far worse. The entire screenshot is just black.

We run our tests with a non interactive service account. Please re-instate the 
old behaviour where the a) entire page is captured and b) non interactive 
service accounts can be used.

Original comment by tim.buck...@gmail.com on 14 Jun 2013 at 12:40

Attachments:

GoogleCodeExporter commented 9 years ago
+1 for reinstating the old behavior. I was really hoping to use this feature 
but capturing only part of the page is of no value for what I'm doing. Resizing 
doesn't help, it's only capturing the portion of the browser visible to the 
user on the screen.

Original comment by IntuitLa...@gmail.com on 25 Jun 2013 at 8:15

GoogleCodeExporter commented 9 years ago
Hoping that this issue gets fixed soon. I'm unable to get any useful output for 
my chrome automation as of now. I would be more satisfied with full webpage 
screenshots that are not 100% accurate than none at all.

Original comment by chris.ha...@gmail.com on 26 Jun 2013 at 8:20

GoogleCodeExporter commented 9 years ago
Like others, we use full page screenshots extensively in automated tests, both 
to compare between browsers, and between versions for hundreds of differently 
branded pages.  Please reinstate support for the old behavior.

Original comment by dmmcc...@gmail.com on 27 Jun 2013 at 8:19

GoogleCodeExporter commented 9 years ago
What is the status on being able to resize a Chrome window via the 
chromedriver? Is there a timeline outlining when the feature will be delivered?

Original comment by paulkier...@gmail.com on 8 Jul 2013 at 10:51

GoogleCodeExporter commented 9 years ago
Since ChromeDriver 2.0, you should be able to maximize the window before you 
take your screenshot.

Original comment by kka...@google.com on 9 Jul 2013 at 4:02

GoogleCodeExporter commented 9 years ago
Please get this one fixed soon.
Like others, this is used for automated tests.
The visible window only cuts off any issues with the page footer etc.
Please reinstate support for the old behavior.

You can maximize via manage().Window.maximize.

Cheers

Original comment by queensto...@gmail.com on 11 Jul 2013 at 10:57

GoogleCodeExporter commented 9 years ago
Here's another vote for getting this fixed. 
I'm using Watir and the following command:

browser.driver.save_screenshot(screenshot_file)

The visible part of the screen captures very well but the rest of the screen is 
saved as black, same as comment #7
Thanks in advance for a speedy fix!

Original comment by ccon...@lynda.com on 25 Jul 2013 at 6:31

GoogleCodeExporter commented 9 years ago
We too rely on full screenshot being available and it's critical for our needs. 
Another vote to get this fixed. I can't think of a scenario where someone cares 
to see only the visible area because users can scroll through the page. Worst 
case please give a parameter that specifies if full or partial screenshot 
should be taken.

Original comment by alex.kal...@creamtec.com on 29 Jul 2013 at 1:53

GoogleCodeExporter commented 9 years ago
I know that the people suggesting to maximize the browser are trying to help, 
but this really isn't a solution, is it? Almost every page I access on a daily 
basis is larger than the scrollable area, even when the browser window is 
maximized. I really need to save a record of the final state of the webpage for 
what I'm currently doing.  

Original comment by jfitis...@gmail.com on 29 Jul 2013 at 4:18

GoogleCodeExporter commented 9 years ago
I'm also facing similar issue when i use Chrome to run my test. I see black 
image at the bottom of page. I deliberately need this to be fixed. Any idea 
when this bug will get fixed?

Original comment by salm...@gmail.com on 30 Jul 2013 at 6:43

Attachments:

GoogleCodeExporter commented 9 years ago
We too are facing the sames issues (and also the same black screen as Tim 
Buckland noted).
We, as our customers, rely on full page screenshots as a way to validate apps' 
UI, and plea that you enable the whole page screenshot (which conforms to the 
W3C sepc: http://www.w3.org/TR/webdriver/#current-window).
You can easily expose the new API in a different URI (hopefully still REST), 
without breaking so many lines of code (and images) already built on top of 
this one.

Original comment by shex...@gmail.com on 4 Aug 2013 at 5:10

GoogleCodeExporter commented 9 years ago
@kkania, is there a relevant ticket at chromium? what about 
https://code.google.com/p/chromium/issues/detail?id=261224 ?
Is there any documentation for the new API? any workarounds?

Original comment by oren.ru...@applitools.com on 5 Aug 2013 at 12:29

GoogleCodeExporter commented 9 years ago
In addition to everything mentioned above, please notice that there is a bug, 
not just a different behaviour. 

Using the latest ChromeDriver server for win32 (v2.1.210652) together with the 
latest Chrome (ver 28.0.1500.95 m) returns a completely black screen when 
taking a screenshot (done using Webdriver java binding). 

Taking a screenshot using a previous version of ChromeDriver (ver. 26.0.1383.0) 
returns a part of the image the size of the viewport BUT NOT the actual 
viewport. It always returns the top left part of the page, (so even if we 
scroll down, the result would not change).

Please fix asap, this has a significant effect on our automatic testing. 

As mentioned before the desired behavior for us is the one which was prevalent 
before - the screenshot should be of the entire page, not just the viewport. 
There were many code line written based on this assumption. At the very least, 
allow this behavior as an option.

Thanks!

Original comment by dpu...@gmail.com on 5 Aug 2013 at 12:46

GoogleCodeExporter commented 9 years ago
I tried digging a bit in the source code, but it's hard when not knowing where 
to look.
A pick at webdriver_session.cc ( 
http://src.chromium.org/viewvc/chrome/trunk/src/chrome/test/webdriver/webdriver_
session.cc) shows that it comprises the method 
"Session::GetScreenShot(std::string* png)" and in it 
"RunSessionTask(..Automation::CaptureEntirePageAsPNG..)".
If someone knows more and can point me to some direction, I'd super appreciate 
it. 

Original comment by shex...@gmail.com on 5 Aug 2013 at 2:13

GoogleCodeExporter commented 9 years ago
Issue 434 has been merged into this issue.

Original comment by kka...@google.com on 6 Aug 2013 at 2:50

GoogleCodeExporter commented 9 years ago
Undoubtedly this would be easier if the following Chromium issue were resolved:

http://code.google.com/p/chromium/issues/detail?id=45209

As of today, however, that issue has been open for 3.25 years.  So, I don't 
have much faith that'll be resolved any time soon.

What approach was taken with Chrome Driver 1?  Chrome 29 is hitting the release 
channel soon and with that breaking Chrome Driver 1, that puts a lot of us in a 
tight spot.  I can port SnapsIE to Firebreath and go that route, but it's a 
pretty big hack and would only work on Windows.

Original comment by nirvd...@gmail.com on 14 Aug 2013 at 4:02

GoogleCodeExporter commented 9 years ago
This issue bugged me a lot since other Drivers in Selenium can take full 
Screenthots.
If it helps someone, I created a simple script in C# which scrolls around the 
page, takes screenshots and stitches it together. The link to the script is: 
http://dev.flauschig.ch/wordpress/?p=341

Original comment by r.baeriswyl on 16 Aug 2013 at 12:53

GoogleCodeExporter commented 9 years ago
It would be helpful if this issue is prioritized and fixed in the next 
chromedriver release.

Original comment by JCrown.n...@gmail.com on 17 Aug 2013 at 11:45

GoogleCodeExporter commented 9 years ago
I agree, this issue is disturbing, we use the screenshots for images comparison 
and checking a test flow, but now we got only partial captures (only visible 
area) and the rest is black. I hope you fix it soon. Thanks!

Original comment by interpa...@gmail.com on 21 Aug 2013 at 1:44

GoogleCodeExporter commented 9 years ago
Waiting to be solved also, we use it also to compare scrrenshots... so not 
valuable in case is not a full page... this issue is quite old... but it seems 
nobody put the enough effort to solve it... anybody is taking a look at this or 
should we change to other solution?

Original comment by TCBl...@gmail.com on 28 Aug 2013 at 10:20

GoogleCodeExporter commented 9 years ago
I do not foresee us being able to do this until 
https://code.google.com/p/chromium/issues/detail?id=45209 is fixed. This will 
likely not happen soon, so I'm going to go ahead and mark this closed. We will 
reopen when we have plans to fix this.

With ChromeDriver 2.2, there are several other bugs with screenshots that 
should be fixed in the upcoming v2.3.

Original comment by kkania@chromium.org on 28 Aug 2013 at 3:03

GoogleCodeExporter commented 9 years ago
Could there be a mixed up? since the bug you mentioned is opened since 2010, 
and we're all pointing to the bug with the release of 2.2 a few weeks back.

Original comment by shex...@gmail.com on 28 Aug 2013 at 3:45

GoogleCodeExporter commented 9 years ago
In any case, is there a chance to have a discussion with the community, e.g., 
in two days time using the IRC chat or Google Hangout which I noticed you guys 
used (i.e. http://www.youtube.com/watch?v=LfubcEqtPKI)?

Original comment by shex...@gmail.com on 28 Aug 2013 at 3:46

GoogleCodeExporter commented 9 years ago
@KKania, As Shex mentioned, I think there's a mistake. The issue you pointed 
out is not relevant at all. Up until a few weeks ago, ChromeDriver took FULL 
SCREENSHOTS of the screen correctly. A chrome update (I think to version 28) 
caused a bug in which only part of the screen is captured, (NOT the visible 
part, mind you, but the top part, even if the page was scrolled down). After 
the latest Chrome update (ver 29) and using the newest version of ChromeDriver, 
there is now NO screenshot capture at all - only completely black screens, the 
size of the what a full screen capture would have been.

Please re-open this issue.

Original comment by dpu...@gmail.com on 28 Aug 2013 at 3:57

GoogleCodeExporter commented 9 years ago
BTW, I Also agree with Shex about a discussion about this issue with the 
community. I think this is a good idea.

Original comment by dpu...@gmail.com on 28 Aug 2013 at 3:59

GoogleCodeExporter commented 9 years ago
#29, there may be several issues in this bug, but the one I'm referring to is 
the originally posted issue that ChromeDriver2 doesn't support full page 
screenshots. This has been the case for all 2.x.

#30, sure. Many of the contributors to chromedriver are on the #selenium 
freenode irc during PST hours (look for kkania or chrisgao particularly). Or 
feel free to email the chromedriver-users googlegroup if you have potential 
ideas on how to solve this problem.

Original comment by kkania@chromium.org on 28 Aug 2013 at 4:02

GoogleCodeExporter commented 9 years ago
@kkania - the originally posted issue is related just to chromedriver2, 45209 
chromium issue is open since 3 years and chromedriver was taking full 
screenshots till driver2.x releases. 
As you have mentioned in earlier posts that ChromeDriver1 allowed  to get a 
full page screenshot, but it was not always 100% accurate to what a user saw. 
The way you  are doing in ChromeDriver2 should be exactly what the user sees.
Can you use the same hook in chromedriver2 as in chromedriver1 till this issue 
gets fixed?
We can atleast continue with our tests as we are blocked now with 2.x and 
chrome browser upgrades due to this limitation. 

Original comment by swapnil3...@gmail.com on 28 Aug 2013 at 4:37

GoogleCodeExporter commented 9 years ago
The new hook doesn't even exist in Chrome 29, but it was deleted because it was 
not supported with the new rendering pipeline.

If you want full page screenshots, for now you'll have to scroll and stitch the 
images together.

Original comment by kkania@chromium.org on 28 Aug 2013 at 4:54

GoogleCodeExporter commented 9 years ago
This is how I feel about this issue with screenshots: 
http://www.nooooooooooooooo.com/

Original comment by edleb...@gmail.com on 12 Sep 2013 at 4:22

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
The issue is still not fixed in chromedriver v2.3 that is currently available 
for download. Can you please let us know when the fix would be coming?

Original comment by a...@wingify.com on 14 Sep 2013 at 8:52

GoogleCodeExporter commented 9 years ago
@kkania - Just an FYI 
Same issue is happening using sel 2.34 and chrome driver 26.0.1383.0 on chrome 
version 23-25
PFA screenshot. How does it relate to chromedriver and browser update?
We just updated selenium version and started getting this issue.

Original comment by swapnil3...@gmail.com on 24 Sep 2013 at 8:41

Attachments:

GoogleCodeExporter commented 9 years ago
If you're using an older version of Chrome, you can use ChromeDriver 1 and 
avoid the problem.  But since Chrome auto-updates for people, this option is of 
decreasing value.

Original comment by nirvd...@gmail.com on 24 Sep 2013 at 9:12

GoogleCodeExporter commented 9 years ago
Hello - I'm using chromedriver 1 for my testing. Earlier we didn't see this 
issue when run against 2.27, chromedriver 1 and chrome 25.
Updating to latest selenium 2.34  we started facing this issue. So i don't 
think pointing this screen capture issue to a chromium issue is correct. 
Something changed in the selenium releases that's causing this issue? 

PFA screenshot of a page having same size which i posted in #39 This one 
doesn't have a black capture.

Original comment by swapnil3...@gmail.com on 24 Sep 2013 at 9:34

Attachments:

GoogleCodeExporter commented 9 years ago
#41 screenshot is taken using 2.27, chromedriver 1 and chrome 25.

Original comment by swapnil3...@gmail.com on 24 Sep 2013 at 9:38

GoogleCodeExporter commented 9 years ago
Please get the full page screenshot back...please don't make people switch to 
chromedriver v1.

Original comment by lenciel on 13 Oct 2013 at 2:15

GoogleCodeExporter commented 9 years ago
Same issue with Chromedriver 2.24 too. Please fix this issue ASAP.

Original comment by a...@wingify.com on 13 Oct 2013 at 2:17

GoogleCodeExporter commented 9 years ago
Disappointing responses from the project guys on this page. What you now have 
is varying functionality between the same function in different browsers (run 
screen shots through firefox and then chrome to see the differences). This is 
the very definition of a bug (ie something that annoys the crap out of me)! 
The response about setting the page to maximum size is very poor and does not 
take in to account reactionary webpages being made for mobile devices as well 
as desktop. Setting full screen in these instances completely breaks the logic 
we are trying to test. 
Please fix this to allow the choice of full screen or not as scrolling down and 
stitching the pages together is a horrible hack that will be prone to false 
positive failures.   

Original comment by keith.f...@just-eat.com on 16 Oct 2013 at 9:49

GoogleCodeExporter commented 9 years ago
Atleast update the thread if you are actively working on this issue. This BUG 
has broken my entire system.

Original comment by a...@wingify.com on 16 Oct 2013 at 6:57

GoogleCodeExporter commented 9 years ago
I'm disappointed by the response as well.  A change was made that broke many 
tests which had been running successfully for months.  Yet we all need to 
develop a work around (which is only necessary for chrome)?  The scroll/stitch 
suggestion is an especially error prone endeavor for us due to animated images 
on our pages.  Our only option is to run our regression suite against every 
browser except chrome until we have time to come up with a real solution.

Original comment by hubb...@gmail.com on 16 Oct 2013 at 9:16

GoogleCodeExporter commented 9 years ago
Please fix ASAP, this break many tests. I need to run my test in chrome only.

Original comment by SamirNaj...@gmail.com on 21 Oct 2013 at 8:19

GoogleCodeExporter commented 9 years ago
Is there any work around or solution to get the full screen in chrome. I am 
facing the same issue not able to capture the whole webpage.

Original comment by byjuphil...@gmail.com on 25 Oct 2013 at 10:28

GoogleCodeExporter commented 9 years ago
Please provide a workaround or a patch for semi webpage screenshot received and 
blank screen on half of the page.

Original comment by jaf...@owler.com on 26 Oct 2013 at 3:44