Can somebody tell me what to modify here, so the file I'm uploading can be uploaded from a subfolder? At the moment the files are stored in the same folder as the python script.
This script helps me to automate the process of adding ads to a site. Here is the part which uploads image files from a json file (photofiles is an array in config.json). I want to store the photos in a subfolder.
# Upload images
fileup = driver.find_element_by_xpath("//input[@type='file']")
for path in photofiles:
uploaded_count = len(driver.find_elements_by_class_name("imagebox-thumbnail"))
fileup.send_keys(os.path.abspath(path))
total_upload_time = 0
while uploaded_count == len(driver.find_elements_by_class_name("imagebox-thumbnail")) and \
total_upload_time < 30:
time.sleep(0.5)
total_upload_time += 0.5
log.debug("Uploaded file in %s seconds." % total_upload_time)