Jump to content

Browser upload forms and VMs


murathp
 Share

Recommended Posts

Hi All,

This is my first post on AUTOIT support forum and prior to posting, I checked 5 pages of prev posts on VM based autoIT execution to make sure I'm not asking a question that got answered many times.

Basically,  I use AUTOIT in a test lab environment where we have a Ruby/WATIR based framework and I upload test files via FF  to a test web application.  The below code works when I have Remote Desktop Connection to my VM but when I disconnect from the VM (however, the session is still running), the below script stops uploading test files to our website.  As soon as I reconnect via RDC, it resumes when I click (tap) on the FF or Upload Dialog.  CmdLine1 contains Mozilla Firefox and CmdLine2 contains the test file pathandname being uploaded.

As I mentioned the code below works fine as long as I leave the RDC window open from my host PC.

Any ideas or recommendations?  Thanks in advance...

 

 

#include <AutoItConstants.au3>
HotKeySet("{F1}","Terminate")
Opt("WinTitleMatchMode",2)
While 1
    If (WinActivate("Mozilla Firefox") <> 0) Or (WinActive("Mozilla Firefox") <> 0) Then
        WinSetState("Mozilla Firefox","",@SW_RESTORE)
        ToolTip("Activated",0,0)
        sendKeystoDialog
        ExitLoop
    Else
        ToolTip("Not Activated",0,0)
    EndIf
    Sleep(1000)
Wend

Func sendKeystoDialog()
    WinActive($CmdLine[1]);
    Send($CmdLine[2]);
    Send("{Enter}");
EndFunc

Func Terminate()
    Exit 0
EndFunc

Edited by murathp
Link to comment
Share on other sites

Is the script running on the host computer or the VM?

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

Hello BrewManNH,

It is running on the VM and as I disconnect from the VM, I always get the Windows message that says "Programs will continue to run even though you are disconnecting...."

The question is does AutoIT needs a hosts Display/Graphics card in order to detect the pop up?  If so....then probably disconnecting will pause Autoit recognition of browser file upload box?  am I thinking right?

 

Thanks for your reply

Link to comment
Share on other sites

If the screen locks when you disconnect, which I'm pretty sure it does, you can't use WinActivate/WinActive/Send or mouse clicks.

https://www.autoitscript.com/wiki/FAQ#Why_doesn.27t_my_script_work_on_a_locked_workstation.3F

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

Hello Murathp,

I don't know if this is an option for you, but I've found better results using VNC (UltraVNC to be specific) as opposed to RDC as disconnecting from VNC doesn't lock the station.  There are others on this forum with more experience than myself, so perhaps a better suggestion will come along.  Good luck with your endeavor!

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...