Black screen when taking screenshot with Internet Explorer driver on Windows build server - windows

I am running several automated browser tests with selenium on our build server. There is no problems taking screenshots while running Chrome or Firefox driver, but when running Internet Explorer driver I just get a black screen.
Virtual Machine
Selenium version: 2.53.0
IEDriver: 2.53.0
OS:
Windows Server 2012
Browser:
Internet Explorer 11
I have gone through all the required configuration in the documentation https://github.com/SeleniumHQ/selenium/wiki/InternetExplorerDriver
I have also tried the third option here:
https://lostechies.com/keithdahlby/2011/08/13/allowing-a-windows-service-to-interact-with-desktop-without-localsystem/
I have also enabled service interaction globally:
https://msdn.microsoft.com/en-us/library/windows/desktop/ms683502(v=vs.85).aspx
When I remotely access the build server, I can trigger running the tests manually. This works fine. So there must be a problem with our CI(TeamCity) setup interacting with the build server.
I am currently stuck and could need some help ?

This is the default behavior of Windows. since Internet Explorer is tightly coupled with Windows, it behaves this way but other browsers don't.
In order to have better resource utilization, when running on remote, windows detects that since session is running in remote mode and nobody is watching the screen, it takes away the resources required to show the screen and screen goes black. When you log into the machine, resources to show screen UI are deployed again.
Hence, when running in remote mode, since there is no screen being showed, screenshot comes out to be blank.
There are only workarounds, no solution.
Workaround:
Workaround 1: Use VNC server for your remote session instead of RDP since VNC keeps the remote session alive.
Workaround 2: Add this command to batch file : tscon rdp-tcp#1 /dest:console
It will switch the session to "1" which is active mode.
By default it will be running on "0" mode. It will disconnect your session and now you can run your test case.

Related

Windows Start GUI Rendering without login

We want to use a 3rd party software on Windows EC2/Cloud Instances, Windows Server 2022. The software requires GUI Interaction. When we close the RDP connection, suddenly our app crashes because of missing UI. Its not a valid option to modify the 3rd party software.
Is there a possibility to start running windows UI rendering without connecting via RDP to that machine before?
Briefly; lets say we started a new Windows instance, without connecting via RDP to that instance, is there a way to start GUI Rendering on that instance? It can be tested with some screenshot scripts, if they work fine without RDP connection on that machine.
As a workaround we do not directly close the RDP connection, instead we are running some scripts which keeps the UI still alive but closes only the RDP session. But with this solution we still need to connect to the machine via RDP first and run this command once. [https://stackoverflow.com/questions/15887729/can-the-gui-of-an-rdp-session-remain-active-after-disconnect]

RemoteApp does not render just the published app

We have several remote apps that are deployed and working. When launching the RDP file itself the surrounding remote session is masked as expected. The user only sees the application and no indication that it is running in RDP.
We are working to use the newer delivery tool of RemoteApp Version 10.2.1817.0. The full desktops work well. However the remote apps open in a window that does not mask off the RD.
RemoteApp
Is this the expected behavior?

UFT script pause when closing Remote Desktop

Im launching an UFT script in a Remote machine. The access to that Remote machine es from my Local machine (the script is launched in the Remote, not from local).
The problem is that if I close the Remote Desktop, the script pauses until I start another time the machine.
How can the script continue with the Remote Desktop closed? I tried going in UFT to Tools -> Options -> Run session -> allow scripting when RDP is closed and entering user and pass with a verified conection, but does not work.
Thanx!
More of a workaround. Have not seen this flag working for some time, but that could just be inexperience.
Alternatives are:
Configure a service account that logs in and starts UFT Run time as soon as the server is started.
Stay logged into the remote session and disable auto screen lock.
Use mouse move tools like MouseJiggle to stop the screen locking
UFT documentation give several places where settings must be configured. (during installation, post installation)

Automate tests on virtual machine without graphical session

Context :
I execute automated GUI tests on virtual machines (there are few of them) on running on windows and using UFT/Ranorex, executions are piloted by Jenkins.
Problem:
VM must have an active graphic session, otherwise, UFT won't run GUI tests (unable to launch browser) and Ranorex will run but poorly and without screenshots. i mean that in my tests, the VM is configured not to "sleep" or to have any screen saver, vm is connected with jenkins properly.
The behavior is : i launch via Jenkins the test, one the build done inthe vm, automation tools start running but then finds difficulties to open browser.
I would like to know if there is any workaround to run those tests without being needed to physically open VMware or Remote desktop Connection.
Notice that the VM is running all the time and the session is always open (we are using a server to host the VM).
So the problem is: how to simulate in windows active graphical session. I guess it's like simulating that there is actually a screen connected even though there isn't...
Any suggestions will be welcomed.
Had to go through this many times and you can find a lot of resources related to your issue in the Ranorex Forum. (My username there is Martin for reference).
But to go through the points you need to do quickly:
1) Have an RDP machine to connect to that is used to run your tests
2) You need to disable screen saver for that machine (I had to do it from registry)
3) Then disable the "On Resume, display logon screen" option under Personalize settings for the screen saver
4) And finally create a .bat script with the following content "%windir%\System32\tscon.exe RDP-Tcp#0 /dest:console"
So basically when you have everything set up (required only once) you will run the .bat script. This will close the RDP window BUT the session will be left open with the screen enabled.
Just connect the RDP with Jenkins and you have full functionality that you need to run your tests.
Regards
Martin
In the Tools ⇨ Options menu, select General ⇨ Run Sessions there you will find an option to Enable continued testing on locked/disconnected remote computers.
If this fails, see my other answer.
I had the same problem when I try to run an automate tests on virtual machine and I find this solution to generated a graphical session although you are not connected to the virtual machine. You need to created a task to opend a session on the virtual machine when you disconected or terminated the session , this created a graphical session but will not function when you are connected and you have the screen minimize. Here is the link for the solution and the explanation
http://blogs.microsoft.co.il/arnona/2016/01/03/keeping-an-active-desktop-session/

selenium web driver on windows 7 parallels vm - browser hidden - allow service to interact with desktop?

I am using a script on my mac host to launch a selenium node on a local parallels VM.
Something like
"prlctl exec Win7-VM-Name-Here 'C:\path_here\start_node.bat'"
The node starts up nicely and registers itself with the hub. I can run tests fine against this node.
However, when the tests are running, the browser is not visible on the VM, which means that screenshots are useless.
I think it has something to do with allowing a service to interact with the desktop, but I can't figure out which one, or how to proceed.
Any help?
Thank you.
Unfortunately, this is a common problem with selenium (or any other browser automation software) on Windows. If selenium is running in the background as a service, the browser will not appear when the tests are being run and taking screenshots will just result in a black picture. If you want to be able to watch the tests being run and grab screenshots, the general consensus is to start your script manually from the command line and leave it running.

Resources