0

I am writing a Chrome extension that will take a file full of photos and automatically upload them to an eBay listing. I'm pretty much a newbie at Javascript/Chrome Extensions.

My idea is to have an

<input id="fileUpload" type="file" />

which will handle the photos and then communicate with eBay's photo upload section, which looks like this:

ebay photo upload section : ebay photo upload section

Here is the code of the HTML element of the first box which has the "add photos" button:

<input class="upl-fileInp" type="file" name="d" value="" aria-label="Add photos" multiple="" tabindex="0" id="upl-21583221343545">

I'm not sure exactly how to approach this. Any help would be appreciated!

Here is a photo of the GUI for the Chrome Extension: Chrome Extension GUI

  • Where are the photos located? – Gergely Szabo Mar 03 '20 at 09:50
  • In a directory on my local system. Running Windows 10 – Garrett Charles Mar 03 '20 at 22:19
  • What part of the process do you want to automate exactly? Clicking add photos and selecting the photos? In that case how will the extension know which photos to select? BTW your question is tagged with "ebay-api", have you tried using the api instead? https://developer.ebay.com/devzone/xml/docs/reference/ebay/additem.html – Gergely Szabo Mar 03 '20 at 23:41
  • Well, so far, I have my chrome extension working so that it just injects a series of JS commands. Here would be a typical list of commands: – Garrett Charles Mar 04 '20 at 01:14
  • document.getElementById('editpane_title').value = 'QO260 Square D Circuit Breaker (Lot of 2)'; document.getElementById('editpane_skuNumber').value = 'inventoryloc: 255'; document.getElementById('storeCat').value = '11454932'; document.getElementById('itemCondition').value = 2500; document.getElementById('editpane_condDesc').value = 'Cleaned and tested. Works great! Please see photos! Items shipped as pictured.'; document.getElementById('descDiv').getElementsByTagName("iframe")[1].contentWindow.document.body.innerHTML = 'QO260 Square D Circuit Breaker'; – Garrett Charles Mar 04 '20 at 01:17
  • These commands just get page elements and then set their values to the strings that I want the form fields to hold. I guess my question is: is there a way to have a JS command to reference the "add photos" element on the page and then set its "value" to a picture that was uploaded to the Chrome Extension? – Garrett Charles Mar 04 '20 at 01:19
  • I've added a screenshot of the extension UI – Garrett Charles Mar 04 '20 at 01:24
  • What you want does not seem to be possible for security reasons: https://stackoverflow.com/questions/1696877/how-to-set-a-value-to-a-file-input-in-html You really should just use the API to automate adding items, I don't see why you would do this hacky thing of filling the page if they provide a dedicated API. – Gergely Szabo Mar 04 '20 at 09:56

0 Answers0