dianaManolito Posted June 13, 2007 Share Posted June 13, 2007 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 More sharing options...
MrBeatnik Posted June 13, 2007 Share Posted June 13, 2007 (edited) 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 June 13, 2007 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 More sharing options...
dianaManolito Posted June 14, 2007 Author Share Posted June 14, 2007 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 More sharing options...
PsaltyDS Posted June 14, 2007 Share Posted June 14, 2007 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 appearsConsoleWrite("jhghgh") ;no text in consoleSounds 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. 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 More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now