Selenium Webdriver shows black screensho with Internet Explorer when run as a scheduled job

1,376 views
Skip to first unread message

narengudipudi

unread,
Aug 13, 2012, 5:52:45 PM8/13/12
to seleniu...@googlegroups.com
Hi,

I am using Selenium Webdriver 2.25 and InternetExplorerDriverServer 2.25 with C#.NET.
I am trying to capture screenshots in Internet Explorer and everything runs fine when I execute the tests manually.
When I run the test as a Windows Scheduled task/job in a Virtual Machine (Windows 2008 Server)
I am seeing a black image for screenshots everytime.

Here is my code:

                    string AbsoluteImagePath = "C:\\Images\1.png";
                    Screenshot imgScreenshot = ((ITakesScreenshot)driver).GetScreenshot();
                    imgScreenshot.SaveAsFile(AbsoluteImagePath, new System.Drawing.Imaging.ImageFormat(new Guid()));

Can you please help me on this?    

anji prassana

unread,
Aug 14, 2012, 3:14:29 AM8/14/12
to seleniu...@googlegroups.com
I hope, Windows Scheduled task/job opens a command prompt while executing the job on specified time.So, perhaps it would capturing that. If so, check your code when exactly you are capturing your screen shot..

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To post to this group, send email to seleniu...@googlegroups.com.
To unsubscribe from this group, send email to selenium-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msg/selenium-users/-/W8Tv35kaZ0MJ.
For more options, visit https://groups.google.com/groups/opt_out.
 
 



--
Thanks&Regards
Anjaneyulu P
"The way you see the things is the way to think and is the way you react upon!!"

Mike Riley

unread,
Aug 16, 2012, 6:26:47 PM8/16/12
to seleniu...@googlegroups.com
I only saw that when I was having problems where the remote server link was hosed for some reason due to the original error.  Can you provide the error stack you are getting back, assuming you are taking the screenshot due to getting some type of error.

It also sometime was useful to watch the VM console when the snapshot was being taken.  That was how I traced my case of this happening to the server communications issue, because I saw the error in the command shell window.

Mike

Darrell Grainger

unread,
Aug 17, 2012, 3:06:20 PM8/17/12
to seleniu...@googlegroups.com
I've had this with other test automation tools. The problem with them was the automation was running as a service and did not have access to the desktop. I essentially wanted the tests to run without being logged in. Turned out that I had to be logged in to be able to get the screen capture.

For your situation, see if there is an option on the scheduled task for something like "interact with desktop" and make sure that is enabled. If that still does not fix it, you might have to set it so the task only runs with the user is logged in and you have to leave the user logged in. 

If you are concerned about security, disable Remote Desktop for the VM and restrict the password access to the VM client, only people who can access the VM client will be able to see the logged in user on the console.

Darrell
Reply all
Reply to author
Forward
0 new messages