Jump to content
Sign in to follow this  
dianaManolito

Choose a file window

Recommended Posts

dianaManolito

Hi !

I am trying to automate some of my tests on a web page that has as mandatory fields a text field where a user should fill in a valid file. Pretty close to this text field, is a Browse button.

-The textField is readonly, so the user can only interact with the Browse button to choose the file.

-The Browse button doesn't have focus.

-If the Browse button is pressed, a 'Choose File' window appear.

I need to fill in a file, so i can go on with my scripts.

Can anyone tell me how to deal with that "Choose File" window? Does AutoIt have some functions or methods to choose automatically a file?

Thx,

Diana

Share this post


Link to post
Share on other sites
MrBeatnik

If a new window opens to select the file, you can:

1) Detect that the new window has opened. (WinExists / WinWait)

2) Switch focus to that window. (WinActivate)

3) Automatically enter the information in the "File" section (by referencing the control).

4) Get the "OK" button to be pressed (again by referencing the control).

5) Detect that the window has closed. (WinExists)

Referencing controls can be done with AU3Info, from the Scite TOOLS menu - well this will find the control ID for you to use.

Edited by MrBeatnik

Please correct me if I am wrong in any of my posts. I like learning from my mistakes too.

Share this post


Link to post
Share on other sites
dianaManolito

After the window appears , the script hangs. No other statement is executed. Not even a ConsoleWrite("whatever"). I manage to click on the Browse button. The "Choose File" window appears and then ........nothing.

Local $is= _IEGetObjByName($oIE, "ctl00_placeHolderMain_flOpen")

_IEAction($is, "click")

;;;;;;window appears

ConsoleWrite("jhghgh") ;no text in console

Share this post


Link to post
Share on other sites
PsaltyDS

After the window appears , the script hangs. No other statement is executed. Not even a ConsoleWrite("whatever"). I manage to click on the Browse button. The "Choose File" window appears and then ........nothing.

Local $is= _IEGetObjByName($oIE, "ctl00_placeHolderMain_flOpen")

_IEAction($is, "click")

;;;;;;window appears

ConsoleWrite("jhghgh") ;no text in console

Sounds like it is an IE window, not a Windows window. The steps described by MrBeatnik won't work on an IE window. You would need to get form and control objects with IE.au3 functions on the new window.

:rolleyes:


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
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
Sign in to follow this  

×