1
我有點卡在如何克服這個障礙。我正在嘗試爲Kijiji製作一個轉貼,並且我在Mac上如何處理文件上傳。我試圖做Selenium上的圖片/文件上傳
driver.find_element_by_id('ImageUploadButton').send_keys(image)
但是,這似乎並沒有做任何事情,我認爲,可能是因爲客齊集的特殊文件上傳的,但我不知道如何突破這個障礙。
有沒有人做過這個?
他們的「查看源文件」頁上的代碼:
<div id="ImageUpload" class="clearfix form-section placeholders">
<p class="images-title">Add at least one photo. Use more to show different angles and details.</p>
<ol id="UploadedImages">
</ol>
<span class="field-message" data-for="FileUploadInput"></span>
<div id="ImageDragAndDrop" class="clearfix">
<div class="image"></div>
<div class="copy">
<h3>Drag and Drop</h3>
<p>Drag and drop to change the order of your pictures.</p>
</div>
</div>
<div id="FileInputWrapper" class="file-input-wrapper">
<input type="hidden" name="file" id="FileUploadInput" >
<h3>Get at least twice the number of replies by uploading images</h3>
<p>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>
<button id="ImageUploadButton" type="button" class="button-update-cancel short file-upload-button">
Select Images</button>
</div>
<input type="hidden" name="images">
</div>
提供'HTML'代碼文件輸入元素 – Andersson
這裏是它的屏幕截圖。 http://imgur.com/a/BRueF –
我很確定你不能發送文本到'button'類型的元素。檢查你的頁面元素'>' – Andersson