Submitting a file

Discussions and Tech Support specific to the iMacros Firefox add-on.
Forum rules
Before asking a question or reporting an issue:
1. Please review the list of FAQ's.
2. Use the search box (at the top of each forum page) to see if a similar problem or question has already been addressed.
3. Try searching the iMacros Wiki - it contains the complete iMacros reference as well as plenty of samples and tutorials.
4. We can respond much faster to your posts if you include the following information: CLICK HERE FOR IMPORTANT INFORMATION TO INCLUDE IN YOUR POST
Post Reply
lanx
Posts: 38
Joined: Sat Jul 03, 2010 2:11 am

Submitting a file

Post by lanx » Thu Apr 27, 2017 3:58 pm

Hi folks!

I'm currently at a dead-point with a form automation where I have to submit a simple XML file to Swiss Customs Agency for goods importing and VAT declaration.

This is the page URL: https://e-dec-web.ezv.admin.ch/webdec/main.xhtml

I have to click the third button (with a folder icon) so that an IFRAME pops-up asking me to choose a local file to submit... and this is exactly where I'm getting crazy trying to make things work.

Code: Select all

SET !REPLAYSPEED MEDIUM
FRAME NAME="mainform:inputFileComponent:uploadFrame"
TAG POS=1 TYPE=INPUT:FILE FORM=ID:fileUploadForm ATTR=NAME:upload&&CLASS:iceInpFileTxt&&TYPE:file CONTENT=>>>>>MYPATH\MYFILE.XML<<<<<
FRAME F=0
TAG POS=1 TYPE=DIV ATTR=CLASS:impex-cmd-none-image-wrapper&&TXT:OK
This code seems to work just like when I manually select the file but... surprise surprise... submitting this form with iMacros leads to a "file couldn't be uploaded" error.

Really hope someone has a nice idea to solve this bad & tricky puzzle!! :twisted:

Oh, and for the sake of completeness (and to prevent chivracq from kicking my butt :lol: :lol: )...
FCI: iMacros for FF 8.9.7, Firefox x64 53.0 (multiprocess disabled), Windows 10 x64 (1703 build 15063.250)

Thank you!
chivracq
Posts: 9291
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: Submitting a file

Post by chivracq » Fri Apr 28, 2017 3:37 pm

lanx wrote:Hi folks!

I'm currently at a dead-point with a form automation where I have to submit a simple XML file to Swiss Customs Agency for goods importing and VAT declaration.

This is the page URL: https://e-dec-web.ezv.admin.ch/webdec/main.xhtml

I have to click the third button (with a folder icon) so that an IFRAME pops-up asking me to choose a local file to submit... and this is exactly where I'm getting crazy trying to make things work.

Code: Select all

SET !REPLAYSPEED MEDIUM
FRAME NAME="mainform:inputFileComponent:uploadFrame"
TAG POS=1 TYPE=INPUT:FILE FORM=ID:fileUploadForm ATTR=NAME:upload&&CLASS:iceInpFileTxt&&TYPE:file CONTENT=>>>>>MYPATH\MYFILE.XML<<<<<
FRAME F=0
TAG POS=1 TYPE=DIV ATTR=CLASS:impex-cmd-none-image-wrapper&&TXT:OK
This code seems to work just like when I manually select the file but... surprise surprise... submitting this form with iMacros leads to a "file couldn't be uploaded" error.

Really hope someone has a nice idea to solve this bad & tricky puzzle!! :twisted:

Oh, and for the sake of completeness (and to prevent chivracq from kicking my butt :lol: :lol: )...
FCI: iMacros for FF 8.9.7, Firefox x64 53.0 (multiprocess disabled), Windows 10 x64 (1703 build 15063.250)

Thank you!

Hum, seems to work for me, try this Script:

Code: Select all

VERSION BUILD=8820413 RECORDER=FX
SET !TIMEOUT_PAGE 30
SET !TIMEOUT_STEP 5
TAB T=1
URL GOTO=https://e-dec-web.ezv.admin.ch/webdec/main.xhtml

TAG POS=1 TYPE=DIV ATTR=TXT:Zollanmeldung<SP>laden
WAIT SECONDS=1

FRAME NAME="mainform:inputFileComponent:uploadFrame"
TAG POS=1 TYPE=INPUT:FILE FORM=ID:fileUploadForm ATTR=NAME:upload CONTENT=<<...>>
TAG POS=1 TYPE=PRE ATTR=TXT:*.xml
FRAME F=0
TAG POS=1 TYPE=DIV ATTR=TXT:OK
(Tested on iMacros for FF v8.8.2, PM v26.3.3 (=FF47), Win10-x64.)

I actually do get the Error Msg (in German) as well, but I guess that's because I don't have a "legit" '.xml' File to upload, I did my "Testing" using some "fake" '.txt' File...

EDIT:
Hum, and stupid Qt/Remark I hope..., make sure you are "really" using v8.9.7 and that your Browser didn't update itself to v9.0.3 as File Upload is not supported anymore in v9.0.3...

"(and to prevent chivracq from kicking my butt :lol: :lol: )..."
=> Ah-ah...!, I don't do "Butt Kicking", ah-ah...!, only "Spanking", oops...! :oops:
- (F)CI(M) = (Full) Config Info (Missing): iMacros + Browser + OS (+ all 3 Versions + 'Free'/'PE').
- I don't even read the Qt if that (required) Info is not mentioned...!
- Script & URL help a lot for more "educated" Help...
Post Reply