Screenshot entire page with Selenium 2 and InternetExplorer

2,688 views
Skip to first unread message

__david__

unread,
May 8, 2011, 10:00:39 AM5/8/11
to Selenium Users
Hi Selenium Users,

for now without success, I am trying to capture a screenshot of an
entire webpage with selenium-dotnet-2.0b3, InternetExplorerDriver and
IE9.

I use getScreenshot() of the ITakesScreenshot interface implemented by
InternetExplorerDriver
I get a screenshot of the viewport, but not of the entire page without
scrollbars.

For Firefox 4 and my same C#-Program but with FirefoxDriver, I get the
entire page image like the old CaptureEntirePageScreenshot of Selenium
1.

Has anyone found a way to get this behaviour with IE as well?

Jim Evans

unread,
May 9, 2011, 3:02:09 PM5/9/11
to Selenium Users
This issue was fixed in r12009 [1] in the trunk on 13 April 2011. This
was after 2.0b3. It will be available in the next release.

Regards,
--Jim

[1] http://code.google.com/p/selenium/source/detail?spec=svn12146&r=12009

David Baehrens

unread,
May 14, 2011, 2:50:26 AM5/14/11
to seleniu...@googlegroups.com
* [Monday 09.05.2011 21:02] Jim Evans:
[screenshot entire page without scrollbars in IE with selenium2 dotnet]

> This issue was fixed in r12009 [1] in the trunk on 13 April 2011. This
> was after 2.0b3. It will be available in the next release.

Thank you very much for your quick and helpful reply!

Unfortunately I am still unable to get a proper screenshot of the entire page
in IE with the trunk version of selenium2 (r12177) as well. With the new DLLs
built from SVN InternetExplorerDriver.getScreenshot() now returns an image of
the correct dimensions of the entire page, but with everything black below the
window viewport region and with scrollbars in this region (please see
attachment). I can watch the IE window resizing as seems to be the approach
taken in the implementation of r12009.

Am I missing something or is there anything I can do to help getting this
fixed?

Thanks again,
David

screenshot.png

Jim Evans

unread,
May 14, 2011, 11:14:17 AM5/14/11
to Selenium Users
It looks like you are testing against a public website. If you could
post your code, someone else could try to reproduce the issue under a
debugger.
>  screenshot.png
> 241KViewDownload

David Baehrens

unread,
May 17, 2011, 2:06:33 AM5/17/11
to seleniu...@googlegroups.com
* [Saturday 14.05.2011 17:14] Jim Evans:

> It looks like you are testing against a public website. If you could
> post your code, someone else could try to reproduce the issue under a
> debugger.

Please find attached my very basic C#-Program to save a screenshot of the
German version of Google News. I get the behavior described below with IE9
under Windows 2008 Server and IE8 under XP as well.

David

Program.cs

David Baehrens

unread,
May 17, 2011, 2:15:55 AM5/17/11
to seleniu...@googlegroups.com
I also uploaded the complete .NET deployment files to
http://david.baehrens.net/ScreenshotIE-trunk.zip

From the archive you may be able to run setup.exe to deploy and run the
screenshot test. It contains also all Selenium 2 DLLs from the trunk which I
use.

Thanks for your help,
David

* [Tuesday 17.05.2011 08:06] David Baehrens:

Jim Evans

unread,
May 17, 2011, 10:57:32 AM5/17/11
to Selenium Users
Using your source code, I'm able to get a full-page screen shot
without incident or further modification. I've not tried with your
compiled binaries.

On May 17, 2:15 am, David Baehrens <baehr...@cs.tu-berlin.de> wrote:
> I also uploaded the complete .NET deployment files tohttp://david.baehrens.net/ScreenshotIE-trunk.zip
> > > > 241KViewDownload- Hide quoted text -
>
> - Show quoted text -

David Baehrens

unread,
May 18, 2011, 2:12:21 AM5/18/11
to seleniu...@googlegroups.com

Jim Evans <james.h....@gmail.com> :

>Using your source code, I'm able to get a full-page screen shot
>without incident or further modification. I've not tried with your
>compiled binaries.

Thanks a lot for this! Could you please tell me which versions of InternetExplorer, Windows, and .NET Framework you have used? For Selenium2-dotnet I suppose the latest trunk version.

Thanks again for your help,
David

Jim Evans

unread,
May 18, 2011, 6:30:09 AM5/18/11
to Selenium Users
This test was done using IE9 on Windows 7 (x64). I'm running the .NET
Framework 3.5 SP1, and am using the latest revision from trunk.

On May 18, 2:12 am, David Baehrens <baehr...@cs.tu-berlin.de> wrote:
> Jim Evans <james.h.evans...@gmail.com> :

yaci

unread,
Jun 3, 2011, 8:20:24 PM6/3/11
to Selenium Users
Hi guys!

I've just downloaded the newly released Selenium 2 rc2 and played with
InternetExplorerDriver for a while. I am facing the same issue as
Dave. Any ideas how to solve it? I use Java and Windows 7. That means
the problem is more common and is not limited to .NET.

Thanks in advance
Jacek

David Baehrens

unread,
Jun 6, 2011, 2:08:16 PM6/6/11
to seleniu...@googlegroups.com
* [Saturday 04.06.2011 02:20] yaci:

> I've just downloaded the newly released Selenium 2 rc2 and played with
> InternetExplorerDriver for a while. I am facing the same issue as
> Dave. Any ideas how to solve it? I use Java and Windows 7. That means
> the problem is more common and is not limited to .NET.

For me finally it worked with the 64bit Version of Windows Server 2008 and a
SVN trunk checkout. Haven't really tested rc2 yet...

Best,
David

David Baehrens

unread,
Jun 13, 2011, 1:09:20 PM6/13/11
to seleniu...@googlegroups.com
* [Wednesday 18.05.2011 12:30] Jim Evans:

> This test was done using IE9 on Windows 7 (x64). I'm running the .NET
> Framework 3.5 SP1, and am using the latest revision from trunk.

Thanks again! I sucessfully made a complete screenshot under Win2008 Server
64bit using the current selenium-dotnet-2.0-rc2. So the issue with the black
area seems to be related to 32bit vs. 64bit, since with Win XP the screenshot
still has the black region below the viewport with the RC2 as well.

But there is another issue with RC2 on Windows 2008 Server 64bit: When I
resize the window to a given width before the screenshot is taken, sometimes
parts of the page are simply cut off. The attached screenshot 1024.png of
http://news.google.de shows a vertical scrollbar and misses the copyright
notice and links in the page footer. Those are correctly present in screenshot
800.png.

Both images were taken with the attached ScreenshotIE.cs with arguments
ScreenshotIE.exe 1024 http://news.google.de 1024.png and
ScreenshotIE.exe 800 http://news.google.de 800.png respectively.

The difference is the first resizes the browser window through JavaScript to a
width of 1024 pixel and the second to a width of 800 pixel.

Any ideas how to solve this?

ScreenshotIE.cs

David Baehrens

unread,
Jun 13, 2011, 1:13:10 PM6/13/11
to seleniu...@googlegroups.com
Sorry forgot to send the screenshots, please see attachments.

David

* [Monday 13.06.2011 19:09] David Baehrens:

800.png
1024.png

Shauvik

unread,
Jun 14, 2011, 3:14:02 PM6/14/11
to Selenium Users
Hi All,

I got this working even on opera.
Thread: https://github.com/operasoftware/operadriver/issues/5

However, the part of the screenshot outside the viewport is black.
From david's observation, it looks like a 32 bit issue. Can someone
shed some light on this -- is it a windows issue or something that can
be handled/fixed in webdriver?

Thanks,
Shauvik


On Jun 13, 10:13 am, David Baehrens <baehr...@cs.tu-berlin.de> wrote:
> Sorry forgot to send the screenshots, please see attachments.
>
> David
>
> * [Monday 13.06.2011 19:09] David Baehrens:
>
>
>
> > * [Wednesday 18.05.2011 12:30] Jim Evans:
> > > This test was done using IE9 on Windows 7 (x64). I'm running the .NET
> > > Framework 3.5 SP1, and am using the latest revision from trunk.
>
> > Thanks again! I sucessfully made a complete screenshot under Win2008 Server
> > 64bit using the current selenium-dotnet-2.0-rc2. So the issue with the
> > black area seems to be related to 32bit vs. 64bit, since with Win XP the
> > screenshot still has the black region below the viewport with the RC2 as
> > well.
>
> > But there is another issue with RC2 on Windows 2008 Server 64bit: When I
> > resize the window to a given width before the screenshot is taken,
> > sometimes parts of the page are simply cut off. The attached screenshot
> > 1024.png ofhttp://news.google.deshows a vertical scrollbar and misses
> > the copyright notice and links in the page footer. Those are correctly
> > present in screenshot 800.png.
>
> > Both images were taken with the attached ScreenshotIE.cs with arguments
> > ScreenshotIE.exe 1024http://news.google.de1024.png and
> > ScreenshotIE.exe 800http://news.google.de800.png respectively.
>
> > The difference is the first resizes the browser window through JavaScript
> > to a width of 1024 pixel and the second to a width of 800 pixel.
>
> > Any ideas how to solve this?
>
> > Thanks for your help,
> > David
>
>
>
>  800.png
> 993KViewDownload
>
>  1024.png
> 957KViewDownload
Reply all
Reply to author
Forward
0 new messages