AutoIt and disconnected remote desktop sessions

1,430 views
Skip to first unread message

dara

unread,
May 14, 2008, 3:21:21 PM5/14/08
to Watir General
I am having a problem with AutoIt code (I'm using something similar to
this:
http://wiki.openqa.org/display/WTR/File+Downloads)

I do most of my test development and running via remote desktop
(rdesktop from Linux). The code that runs for File Downloads works
just fine when an rdesktop session is connected and active but hangs
if it runs when the rdesktop session is minimized or disconnected (NOT
logged off). I don't have similar problems with any Watir code.

I have searched the archives and not found anyone else reporting this.
Anyone got any suggestions?

Željko Filipin

unread,
May 15, 2008, 7:15:06 AM5/15/08
to watir-...@googlegroups.com
Does this thread help (modal dialogs and remote desktop)?

http://rubyforge.org/pipermail/wtr-general/2006-December/008472.html

Željko
--
ZeljkoFilipin.com

dara

unread,
May 15, 2008, 10:52:10 AM5/15/08
to Watir General
No, that does not help.

dara

unread,
May 15, 2008, 12:06:57 PM5/15/08
to Watir General
Here is the code for a very simple example (using an arbitrarily
chosen publicly available website):

require 'watir'

require 'test/unit'



class TC_FileDownload < Test::Unit::TestCase



def test_file_download

10.times do

b = Watir::IE.new

b.goto(('http://www.wa.gov/esd/lmea/download/download.htm'))

b.link(:url, 'http://www.wa.gov/esd/lmea/download/
em9496zp.zip').click_no_wait

sleep 10#dialog doesn't appear instantly

prompt_message = "Do you want to open or save this file?"

window_title = "File Download"

save_dialog = WIN32OLE.new("AutoItX3.Control")

# I removed these two lines to strip down the code to the

# absolute bare minimum, they don't make any difference to the problem

# save_dialog.WinWaitActive(window_title, prompt_message, 25)

# save_dialog.ControlFocus(window_title, prompt_message, "&Open")

save_dialog.Send("O")

b.refresh

assert(b.contains_text('The Annual Labor Market and Economic
Report'))

b.close

end

end

end

Runs fine with the rdesktop session active (10 assertions, 0 failures,
0 errors). If I minimize the rdesktop window, the test errors and the
browser is hung on the download dialog.

1) Error:

test_file_download(TC_FileDownload):

WIN32OLERuntimeError: refresh2

OLE error code:80004005 in <Unknown>

<No Description>

HRESULT error code:0x80020009

Exception occurred.

c:/ruby/lib/ruby/gems/1.8/gems/watir-1.5.4/./watir/ie.rb:381:in
`method_missing'

c:/ruby/lib/ruby/gems/1.8/gems/watir-1.5.4/./watir/ie.rb:381:in
`refresh'

Sandbox.rb:20:in `test_file_download'

Sandbox.rb:7:in `times'

Sandbox.rb:7:in `test_file_download'



1 tests, 0 assertions, 0 failures, 1 errors

Bill Agee

unread,
May 15, 2008, 1:10:32 PM5/15/08
to watir-...@googlegroups.com
Maybe try using autoit's "ControlSend" function in place of "Send"?

dara

unread,
May 15, 2008, 3:58:08 PM5/15/08
to Watir General
Same thing happens with ControlSend as happens with Send. My problem
seems to be with any AutoIt code, I have tried many different
functions, all giving the same result.

On May 15, 1:10 pm, "Bill Agee" <billa...@gmail.com> wrote:
> Maybe try using autoit's "ControlSend" function in place of "Send"?
>

Bill Agee

unread,
May 16, 2008, 5:25:13 AM5/16/08
to watir-...@googlegroups.com
Weird, so it sounds like when rdesktop is minimized, the remote Windows box knows, and the input coming from autoit is handled differently.
 
I found a mailing list post from someone who saw similar behavior when using Awt.Robot, but unfortunately there was no response:
 
 
Have you tried using VNC server instead of remote desktop?  That could be a quick band-aid...it's been a long time since I last used it, but if memory serves, VNC doesn't necessarily tell Windows if the client disconnects.  You might be able to close your VNC client, and have the Windows machine think a user is still logged in on the console.
 
Running these types of tests on a Windows machine in VMware can also avoid this sort of problem - if you configure the Windows VM to always log a user in at startup, an interactive desktop will always be up and running, ready to run GUI automation code, regardless of whether anyone is actually RDP'd in and looking at the desktop.
 
Thanks
Bill

 
Reply all
Reply to author
Forward
0 new messages