Jump to content

Recommended Posts

Posted

Hi guys,

I'm trying to create a script where I navigate to a web app, click a browse button to open a "Choose File to Upload" screen, then select a file to upload, and click Open. 

Here's my code: 

; Click Browse Button (Step 1 attachment)
$oIE = _IECreate ("https://InternalWebsite.net/import.aspx", 1, 1, 1, 1)
$o_submit = _IEGetObjByName ($oIE, "FILE1")
_IEAction ($o_submit, "click")
               
; Navigate to file (Step 2 attachment)
$oIE = _IECreate ("https://InternalWebsite.net/import.aspx", 1, 1, 1, 1)
$oT = _IEGetObjById($oIE, 'fileExample')
WinWait("Choose File to Upload")
$hChoose = WinGetHandle("Choose File to Upload")
ControlSetText($hChoose, "", "Edit1", "C:\filepath\1.csv")
ControlClick($hChoose, "", "Button1")

My script gets stuck on selecting a file. I tried even using a SEND command to type in the file path, but that doesn't work either. I'm using IE and AutoIt v3.3.14.2. Funny thing is that if I intervene and select the file manually and click open, my script continues successfully..  Any suggestions would be appreciated. Thanks!


 

Step 1 - Click Browse.png

Step 2 - Select File.png

Posted

With fileopendialog or whatever it is called, the script waits for the window to close, waits for the return value, here it's probably the same.

Maybe you could have a adlib function checking for that window every second or so, and once it's up, the function does its thing and the script continues.

In said function you can have a check so that once it runs, it never runs again. or maybe unregister the adlib.

 

  Reveal hidden contents

IUIAutomation - Topic with framework and examples

Au3Record.exe

  • 2 months later...

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
×
×
  • Create New...