Skip to content
This repository has been archived by the owner on Nov 29, 2018. It is now read-only.

Capture Screenshot keyword captures black screen for IE #3536

Closed
lukeis opened this issue Mar 3, 2016 · 30 comments
Closed

Capture Screenshot keyword captures black screen for IE #3536

lukeis opened this issue Mar 3, 2016 · 30 comments

Comments

@lukeis
Copy link
Member

lukeis commented Mar 3, 2016

Originally reported on Google Code with ID 3536

I have 3 virtual machines with various versions of IE. All of the screenshots captured
are black screens regardless whether the virtual machines and the host are locked or
not. The test automation is triggered from Hudson.

When I manually tested Capture Screenshot keyword using IE, it seemed to be fine. However
after I left the virtual machines over the weekend for test execution, the problem
started. Rebooting the virtual machines and the host did not help.

I don't see anything abnormal in selenium log.

Virtual Machine 1
------------------
Selenium version:
2.8.1 package but replace selenium-server.jar with 2.20.0

Robot Framework version:
2.6.3

OS:
Windows XP SP3

Browser:
Internet Explorer 7


Virtual Machine 2
------------------
Selenium version:
2.8.1 package but replace selenium-server.jar with 2.20.0

Robot Framework version:
2.6.3

OS:
Windows XP SP3

Browser:
Internet Explorer 8


Virtual Machine 3
------------------
Selenium version:
2.8.1 package but replace selenium-server.jar with 2.20.0

Robot Framework version:
2.6.3

OS:
Windows 7 Ultimate SP1 (32 bit)

Browser:
Internet Explorer 9


Reported by totziens on 2012-03-12 09:00:40

@lukeis
Copy link
Member Author

lukeis commented Mar 3, 2016

Issue 3561 has been merged into this issue.

Reported by james.h.evans.jr on 2012-03-14 21:23:26

@lukeis
Copy link
Member Author

lukeis commented Mar 3, 2016

Have you tried leaving a VNC server running on every virtual machine?

We had this issue where Windows would sometimes cause black screens because the machine/desktop
was not in use. Running a VNC service on those machines fixed that problem for us.

Reported by jochendelabie on 2012-03-18 15:05:40

@lukeis
Copy link
Member Author

lukeis commented Mar 3, 2016

Thanks for the suggestion. Our test automation job is triggered remotely from Hudson
actually. With VNC, I have no idea how we can accomplish the tasks done in Hudson (i.e.
check out newly updated files, display the results in Hudson job, multiple Hudson jobs
dependency, etc)

Reported by totziens on 2012-03-19 09:26:03

@lukeis
Copy link
Member Author

lukeis commented Mar 3, 2016

Found a workaround utilising the idea of VNC server. Instead of using VNC server, I
remove the Hudson windows service at the slave node. I create a batch file using command
mode to establish the connection to Hudson.

Content of the sample batch file (assume it's called test.bat) is as follows. c:\my-slave\
is the location of slave.jar.

cd c:\my-slave\
"C:\Program Files"\Java\jre6\bin\java -jar slave.jar -jnlpUrl http://myhudson.com:8080/computer/my_machine_99/slave-agent.jnlp

Place the newly created batch file, test.bat, into the Windows Startup directory to
launch the batch file each time it's logon.

With this solution, I don't get black screenshot anymore.

Reported by totziens on 2012-03-20 10:49:01

@lukeis
Copy link
Member Author

lukeis commented Mar 3, 2016

By the way, the Robot Framework command used is "Capture Screenshot" (not Capture Page
Screenshot). Ideally, Capture Page Screenshot is preferred because the entire page
can be captured but it does not seem to be able to work at all for Internet Explorer.

Reported by totziens on 2012-03-20 10:51:48

@lukeis
Copy link
Member Author

lukeis commented Mar 3, 2016

We've found that the first screenshot taken with a driver often is all black, but subsequent
ones will not be; try taking the screenshot again

Reported by dawagner on 2012-04-10 22:55:39

@lukeis
Copy link
Member Author

lukeis commented Mar 3, 2016

The black screen capturing issue I encountered was always black screen being captured
regardless how many times I run the robot framework script. I didn't try capturing
the same screen more than once within the same script though. That could be a potential
workaround too.

Anyway, it has been overcome by my workaround above utilising a batch file to establish
connection to Hudson instead of using windows service.

Thanks for the suggestion anyway as it has given me more workaround ideas.

Reported by totziens on 2012-04-11 00:28:39

@lukeis
Copy link
Member Author

lukeis commented Mar 3, 2016

I have the same problem and I've tried the VNC workaround, but it didn't work for me.
Could you please post your VNC version and settings?

Reported by jaruzafa on 2012-04-19 09:56:12

@lukeis
Copy link
Member Author

lukeis commented Mar 3, 2016

I finally managed to get a workaround for this issue.
In my case, the problem was that I connected to my test servers with Remote Desktop,
which locks the computer after disconnect (I haven't found any way to change this behaviour).
If the test computer is locked, IE screenshots go black.
So I've created a disconnect.bat file with this line:
tscon rdp-tcp#0 /dest:console

Instead of disconnecting from remote desktop, I run disconnect.bat and my test computer
doesn't get locked. Now I have real screenshots :)
I have to credit Nepatsfan from: 
http://forum.soft32.com/windows/stop-Remote-Desktop-locking-host-ftopict360189.html
for give me a hint on this.


Reported by jaruzafa on 2012-04-19 11:36:10

@lukeis
Copy link
Member Author

lukeis commented Mar 3, 2016

Reported by barancev on 2012-05-11 05:15:21

  • Labels added: Component-WebDriver, Browser-IE

@lukeis
Copy link
Member Author

lukeis commented Mar 3, 2016

I got the same issue on my VMs. I used selenium grid to manage 10 nodes on 10 VMs. 5
of the VMs are windows7 x64 with IE9. The screenshot from these 5 VMs are always black
if it not in use. The selenium version is 2.13. But it worked properly on other 5 VMs
whose OS is windows xp with IE8, even if the VMs are not in use. Do you have schedule
to fix is issue?

Reported by caeserwliu on 2012-05-17 05:28:08

@lukeis
Copy link
Member Author

lukeis commented Mar 3, 2016

Please update to the latest selenium release (2.21 as I write this) and retry. A fix
for just this problem landed relatively recently.

Reported by simon.m.stewart on 2012-05-17 14:58:55

@lukeis
Copy link
Member Author

lukeis commented Mar 3, 2016

I'm running selenium 2.21 and I've got the same problem. See my workaround: http://code.google.com/p/selenium/issues/detail?id=3536#c9

Reported by jaruzafa on 2012-05-18 10:31:02

@lukeis
Copy link
Member Author

lukeis commented Mar 3, 2016

I used your workaround from http://code.google.com/p/selenium/issues/detail?id=3536#c9
 . Works nicely for me. Thanks

Reported by karsten.packmohr on 2012-08-08 13:53:25

@lukeis
Copy link
Member Author

lukeis commented Mar 3, 2016

I see the same issue. I am running selenium-server-standalone-2.23.0.jar on Win7. The
screenshot in IE9 are completely black. This happens intermittently.

Reported by mdzyuba@google.com on 2012-08-17 19:03:07

@lukeis
Copy link
Member Author

lukeis commented Mar 3, 2016

Regarding comment 9, it works for me.  I also added this line to the batch file, since
occasionally someone will log into the machine while someone else is on:

tscon rdp-tcp#1 /dest:console

Reported by jricjr on 2012-08-28 03:27:51

@lukeis
Copy link
Member Author

lukeis commented Mar 3, 2016

This still happens in webdriver 2.25

Reported by adidon on 2012-11-01 13:11:11

@lukeis
Copy link
Member Author

lukeis commented Mar 3, 2016

Hi all. #4 also works for me with the latest IE 2.29.1 webdriver version.
The question is what is the basic difference between jnlp and windows service for establishing
connection between master and slave that in case of jnlp connection - it works?

Reported by Vk.Vital on 2013-02-11 20:36:22

@lukeis
Copy link
Member Author

lukeis commented Mar 3, 2016

I faced the same issue. It's shocking that Chrome update helps! Just update your chrome.

Reported by 11egork on 2013-05-24 14:05:56

@lukeis
Copy link
Member Author

lukeis commented Mar 3, 2016

It's configuration problem not selenium.

Just a few notes about screenshots for "headless" configuration:

1. if you use service-based configuration you _need_ to setup it to use local account.
SYSTEM account doesn't have possibility to interact to desktop. 
Be sure that you local account can log in successfully.

2. if you use service-based configuration you _need_ to set "Allow service to interact
with desktop" option enabled for the service. Otherwise service can not interact with
desktop.

3. If you use RDP to run grid2 node please be sure that you session doesn't become
locked. Use something like "tscon SessionID /dest:console" to close the Remote Desktop
session and reconnects the session to the remote computer's console.

4. If you use RDP to run grid2 node please do not disconnect from the Remote Desktop
Connection session, lock the computer or minimize the Remote Desktop window. In such
case Windows switches the Remote Desktop session to the GUI-less mode and does not
draw the GUI. It prevents to take screenshots.
You could change this behaviour by setting:
HKEY_CURRENT_USER\Software\Microsoft\Terminal Server Client\RemoteDesktop_SuppressWhenMinimized
= 2
HKEY_LOCAL_MACHINE\Software\Microsoft\Terminal Server Client\RemoteDesktop_SuppressWhenMinimized
= 2
(another keys may be used on x64)
and rebooting after.

Another good solution is to use VNC instead of RDP.

Working as intended from my point.

Also be note that some features of IEDriverServer (proxy at current moment) _can not_
work in service mode.

Reported by a.u.savchuk on 2013-08-14 10:39:35

  • Status changed: WorkingAsIntended

@lukeis
Copy link
Member Author

lukeis commented Mar 3, 2016

I have tried  using selenium 2.33 jar and IEDriverServer 2.33 library.

Windows 8, IE 10 screen shot works well
Windows XP IE 8 Screen shot works well
but in Windows 7 IE9 browser screen shot is black, i have tried the work around mentioned
by a.u.savchuk@gmail.com , but it does not works in IE 9 windows7

Reported by praneeth.krishna on 2014-01-03 07:10:52

@lukeis
Copy link
Member Author

lukeis commented Mar 3, 2016

Have you tried this workaround: https://code.google.com/p/selenium/issues/detail?id=3536#c9
?

Reported by jaruzafa on 2014-01-03 08:35:16

@lukeis
Copy link
Member Author

lukeis commented Mar 3, 2016

I'm running Windows 7 IE9 and getting the black screenshot referenced in #21, without
using remote desktop; however, the browser in question is running an applet.  Is the
applet likely the cause? Or the particular browser I'm using?

Reported by SBergstein on 2014-02-10 22:36:21

@lukeis
Copy link
Member Author

lukeis commented Mar 3, 2016

for me comment  #20 a.u.savchuk helped. Remote desktop Login was the problem. I rerun
test after disconnecting remote desktop Login it's working fine.

Reported by bikash.choudhary@rightster.com on 2014-06-28 18:48:20

@lukeis
Copy link
Member Author

lukeis commented Mar 3, 2016

I am running Windows 7 IE8 64 bit, the first 3 screen is fine after that I am getting
black

Reported by anand4180 on 2014-09-20 07:20:06

@lukeis
Copy link
Member Author

lukeis commented Mar 3, 2016

I am facing this issue in Desktop

Reported by anand4180 on 2014-09-20 07:48:11

@lukeis
Copy link
Member Author

lukeis commented Mar 3, 2016

"tscon SessionID /dest:console" actually helped to capture proper non-black screenshots,
but I noticed that driver.manage().window().setSize() method does not work in this
case. Any thoughts on this?

win-7x64, IE11, IEDriverServer-2.42

Reported by evgeny.mukhin on 2014-10-15 04:11:43

@lukeis
Copy link
Member Author

lukeis commented Mar 3, 2016

>>but I noticed that driver.manage().window().setSize() method does not work in >>this
case.

Either in chrome

Reported by evgeny.mukhin on 2014-10-15 05:18:45

@lukeis
Copy link
Member Author

lukeis commented Mar 3, 2016

I've used @jaruz tip and it has worked perfectly for my slave nodes (VMs).

Special very thanks!!!!

Reported by jorge.merino.panel on 2014-11-18 11:28:35

@lukeis
Copy link
Member Author

lukeis commented Mar 3, 2016

Reported by luke.semerau on 2015-09-17 18:15:02

  • Labels added: Restrict-AddIssueComment-Commit

@lukeis lukeis closed this as completed Mar 3, 2016
@SeleniumHQ SeleniumHQ locked and limited conversation to collaborators Mar 4, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant