2

I am using Selenium IE WebDriver (version 2.46 latest) in order to perform my tests on IE. The setup is:

  • I am using Jenkins to trigger my tests
  • the IE is on a remote virtual machine where also the tests are placed and executed

The problem is that some of the tests require browser window focus and the tests fails due to focus issues. The issues are gone when I am logged on the virtual machine even the machine remote desktop connection is minimized. Even if I run the Jenkins job with one user and I am logged on the machine with another one - this is not a problem. The issue is that when I close the remote connection, the tests fail again. I am not sure what this has to do with the opened connection and how the mouse movement is detected on the machine.

Does anyone had such an issue and maybe can help?

2
  • The issue is how Remote Desktop works - it takes over a session on the machine and when you disconnect (or even minimize the Remote Desktop window), that session becomes inactive (for good reasons). What you are seeing is a consequence of that behavior.
    – cdavid
    Jul 7, 2015 at 18:02
  • It's not the problem in the session because for the rest of the browsers the selenium focus method of the driver is working as expected... And also for IE 10 and 11 there is no such a problem - only for IE9...
    – infinity
    Jul 8, 2015 at 8:04

2 Answers 2

1

Here is temporary solution. Create bat file with this code:

for /f %%i in ('qwinsta ^| findstr ">rdp-tcp#"') do set RDP_SESSION=%%i :: Strip the > set RDP_SESSION=%RDP_SESSION:>=% tscon %RDP_SESSION% /dest:console echo y | rwinsta 65536

I tested it and it works properly. Source: prevent the RDP session from getting locked

0

My recommendation: some sort of a listener + AutoLogon (https://technet.microsoft.com/en-us/library/bb963905.aspx)

The listener "listens" for instructions from your Jenkins server - this can be something really dumb like PSExec remotely (e.g.: PSExec run remote batch file ) or something else (depending on your stack).

AutoLogon guarantees that the user that you specify is automatically logged on and has a full session (not a Remote Desktop session) on the machine. Under that session, you can run whatever you want. Logging in (to debug failed tests) involves logging in as a different user, running autologon /delete and then Task Manager -> Users -> the user -> Connect.

Makes sense? Let me know if I can help explain more.

/cd

3
  • I know that the session is available for the user. But this is not solving the issue. Only when I am logged on the machine the tests are correctly executed nevertheless without being logged in the user is available for the session... And the strange thing is that I observe this only on IE9. For IE10 or 11 the problem is not existing. This is why I assume this is a matter of a service or some add-on or plugin in the browser... Don't know what to check though...
    – infinity
    Jul 8, 2015 at 8:02
  • Hi again, I have tried using this command from Jenkins: D:\Scripts\PsExec.exe \\computer -u <user> -p <pass> D:\Scripts\Autologon.exe <user> <domain> <pass> but the result is the same... I am starting to think that I will need to open a remote desktop session from Jenkins during the test...
    – infinity
    Jul 9, 2015 at 13:08
  • I think I did not explain it properly :) autologon.exe makes sure that there is an active logged on session (after a reboot). So your process would be: 1) run autologon.exe on the remote machine 2) reboot the machine (for autologon to take effect) - the machine is now ready to accept commands. 3) use psexec to run your test
    – cdavid
    Jul 9, 2015 at 15:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.