Я делаю приложение (Windows 10 и селеновый хромедривер), которое делает мне объявление на рекламном веб-сайте, со всеми подробностями, и теперь я хочу перейти к части загрузки изображений для него. Я пытаюсь что-то вроде:
# Upload images
# Change the directory from the current running project's directory
# to the subsequent images folder
os.chdir(os.getcwd()+"/images")
# For each image that's in the folder
for file in os.getcwd():
# Click the upload button on the website to open up the windows
# directory viewer, and then select all the images it sees there?
driver.find_element_by_xpath('//*[@id="ImageUploadButton"]').send_keys(os.getcwd()+file)
# change directory back to the original os.getcwd()
os.chdir("..")
... пытаясь адаптировать другой ответ, который я нашел на SO. У меня есть программа для запуска до этого момента, и она работает без ошибок, однако она заканчивается, вызывая это окно каталога:
![enter image description here](https://i.stack.imgur.com/7DJrE.png)
... который явно не является каталогом проекта и не является каталогом папки project / images. Я даже не уверен, что это правильное решение, но я впервые пытался это сделать. Есть идеи? Спасибо!
UPDATE
В соответствии с запросом, здесь HTML-код раздела fileupload:
<h2>
<div class="number">4</div>
Media</h2>
<ul class="post-ad-layout">
<li class="jsonly">
<div id="MediaImageUpload" class="clearfix form-section placeholders">
<p class="images-title">Add at least one photo to complete your ad.</p>
<div class="images-content">
<h3>Add photos to attract interest to your ad</h3>
<div class="images-content-secondary">
<p>Include pictures with different angles and details. You can upload a maximum of <span id="MaxImages">10</span> photos, that are at least 300px wide or tall (we recommend at least 1000px).</p>
<p>Drag and drop to change the order of your pictures.</p>
</div>
</div>
<ol id="MediaUploadedImages">
</ol>
<span class="field-message" data-for="FileUploadInput"></span>
<div id="FileInputWrapper" class="file-input-wrapper">
<input type="hidden" name="file" class="fileErrorBox">
<div class="imageUploadButtonWrapper">
<button id="ImageUploadButton" type="button" class="button-update-cancel short file-upload-button">
Select Images</button>
</div>
</div>
</div>
</li>