rawpanda wrote: ↑Fri Jan 14, 2022 12:15 am
Hi guys,
I was trying to upload images to a website by using .csv file but failed, every times I go to uploading page, it will be a new ID like this:
And this is the macro when i recorded:
Code: Select all
TAG POS=1 TYPE=DIV ATTR=CLASS:"m-uploader__dropzone-icon icon tp-file-single"
TAG POS=1 TYPE=INPUT:FILE ATTR=NAME:file CONTENT="C:\\fakepath\\WEDDING 40 1.png"
' there isn't anything like: ATTR=ID:*
I tried to edit the macro:
Code: Select all
VERSION BUILD=2021
TAB T=1
TAB CLOSEALLOTHERS
SET !PLAYBACKDELAY 0.2
SET !DATASOURCE Teepublic.csv
SET !LOOP 2
SET !DATASOURCE_LINE {{!LOOP}}
URL GOTO=https://www.teepublic.com/
TAG POS=2 TYPE=A ATTR=HREF:https://www.teepublic.com/design/quick_create
TAG POS=1 TYPE=DIV ATTR=CLASS:"m-uploader__dropzone-icon icon tp-file-single"
TAG POS=1 TYPE=INPUT:FILE FORM=ID:edit_design_* ATTR=NAME:file CONTENT={{!COL1}}
But it still failed, imacros didn't upload the file to the website.
I'm using
Code: Select all
imacros 2021 app version, Window 10 Home Edition.
Please help to fix this.
Thank you very much in advance!
I don't understand what you mean exactly by "ID"...?
=> Is it the "40 1" Part in the Filename...?
The only "ID" I see in your Script is the 'ID' for the 'FORM' Param in:
Code: Select all
TAG POS=1 TYPE=INPUT:FILE FORM=ID:edit_design_* ATTR=NAME:file CONTENT={{!COL1}}
The 'FORM' Param can usually be omitted, unless there are several Forms on the Page, and it was not even present in the mini-Script you said had been recorded by iMacros:
Code: Select all
TAG POS=1 TYPE=INPUT:FILE ATTR=NAME:file CONTENT="C:\\fakepath\\WEDDING 40 1.png"
"But it still failed, imacros didn't upload the file to the website.":
=> Do you still get the Upload Popup or not...?
If = Yes, you included the whole Path (+ Filename) in your '.csv' DataSource, => did you make sure to double the Backslashes everywhere in the Paths like visible in the mini recorded Script, as you are using Double Quotes for the 'CONTENT' Param as your Path probably contains Spaces, and the Filename does anyway...?
... But hum..., no, wait...!, this is not correct, I think..., => as because you are using the '!COL1' Var, iMacros should be able to handle Spaces by itself, and can even accept (Single) Backslashes + Double Backsalshes + even Single and Double Forward Slashes, even on Windows...
The "thing" is, even if you've specified your Path + Filename as "C:\\fakepath\\WEDDING 40 1.png" (with the Double Quotes) in your '.csv', those Double Quotes will be ignored when running the Script..., => safer might be to replace all Spaces with "<SP>" (without Quotes), or maybe you can try:
Code: Select all
TAG POS=1 TYPE=INPUT:FILE FORM=ID:edit_design_* ATTR=NAME:file CONTENT="{{!COL1}}"
=> With Double Quotes surrounding the '!COL1' Var...
I'm not sure, I would need to test...
... And even "safer" is to try to avoid all Spaces in Paths and Filenames, ah-ah...!
And if all Files/Images are located in the same Folder, it might be "easier" to only specify the Filename in your '.csv' and to hard-code the Path to that Folder, ... or to use a Var...
>>>
If you don't come out by yourself, I could have a Look at the Site, if you can share some Test Account...
Or if you don't want to share some Login & Password "publicly", you can also "fake-report" my Post, then only myself (Mod on the Forum) and the Forum Admin (= @TechSup) will be able to see your Msg/Report...
- (F)CI(M) = (Full) Config Info (Missing): iMacros + Browser + OS (+ all 3 Versions + 'Free'/'PE'/'Trial').
- FCI not mentioned: I don't even read the Qt...! (or only to catch Spam!)
- Script & URL help a lot for more "educated" Help...