Jump to content

Choose a file window


Recommended Posts

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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
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...