Webrecorder: File Upload Form - LibFunc FormFill unusable

Technical support and scripting issues

Moderators: JRL, Dorian (MJT support)

Post Reply
techsc
Newbie
Posts: 7
Joined: Tue Sep 25, 2007 12:58 pm

Webrecorder: File Upload Form - LibFunc FormFill unusable

Post by techsc » Tue Sep 25, 2007 11:07 pm

Hello,

WebRecorder recorded the following when I filled in the form to upload a file to a Website:


Let>FrameName={""}
Let>FormName={"uploadForm"}
Let>FieldName={"myFile"}
Let>FieldValue={"C:\temp\test.txt"}
LibFunc>hIE,FormFill,r,%IE[0]%,str:FrameName,str:FormName,str:FieldName,str:FieldValue,0


Unfortunately, it has come to my attention, that this action is not allowed by the MS Internet Explorer. Once re-played this action won't fill in the form field with the file path information.

From another forum post I've learned to work-around with tabs and direct input via the send-command:


Let>k=0
Repeat>k
Let>k=k+1
Press Tab
Wait>0.2
Until>k,22

Send>C:\temp\test.txt"


Well, the number of required tabs varies and it is a very unstable solution at my system. i.e. I had to play with the Wait-command and to introduce a pause between each tab press since internet explorer seems to swallow some from time to time.

So my question is: Is there generally a better and stable solution available to fill in file-upload forms?

Your help is greatly appreciated!

Chris

User avatar
Marcus Tettmar
Site Admin
Posts: 7395
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Wed Sep 26, 2007 6:41 am

Unfortunately, as you have discovered, Internet Explorer prevents the scripting of file upload boxes. They cannot be controlled in the same way as other form fields. They have done this for security reasons.

See:
http://www.microsoft.com/technet/securi ... 0-093.mspx

"By design, only the browser user should be able to enter text into the box that indicates the name of the file to upload."

So Microsoft blocked INPUTs of TYPE=FILE from having their value set by a script.

Therefore at present the only solution I am aware of is to simulate a user via keystrokes, as you are doing.

As you have noted, tabbing to the object can be unreliable if the object changes position relative to other objects, or the design of the page changes. One solution could be to find the form upload box using Image Recognition (FindImagePos).
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

techsc
Newbie
Posts: 7
Joined: Tue Sep 25, 2007 12:58 pm

Post by techsc » Wed Sep 26, 2007 8:40 am

Thanks for your reply.

Sorry, I have no idea how to work with the FindImagePos. Could you help me?

Here's the saved page:
http://www.tsxn.com/transfer/upload-button.htm

User avatar
Marcus Tettmar
Site Admin
Posts: 7395
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Wed Sep 26, 2007 8:45 am

Take a look at this and watch the video demo:
http://www.mjtnet.com/blog/2007/02/20/h ... cognition/
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

techsc
Newbie
Posts: 7
Joined: Tue Sep 25, 2007 12:58 pm

Post by techsc » Thu Sep 27, 2007 1:22 pm

Works like a charme!

Great tutorial :lol:

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts