Quantcast
Channel: Active questions tagged selenium - Stack Overflow
Viewing all articles
Browse latest Browse all 98356

Trouble saving file uploaded using Python Selenium

$
0
0

I am working in Selenium using Python and am working with Chrome.  When I get to a section for a picture upload, I do the following:

    pictureChange = driver.find_element_by_xpath("//input[@class='custom-file' and @type='file']")
    photoLocation = [I enter the file location on my locally mapped drive]
    pictureChange.send_keys(photoLocation)

This seems to work as expected and the picture pops up in an overlay for cropping/zooming before saving the new picture.  The overlay is a div class="modal-box" id="croppicModal."  I am able to interact with the picture to zoom out and whatnot.  But when I click "Save" (either manually or using my program), the new picture does not save.  The overlay just goes away and the old picture is still showing.  If I manually choose the file to upload and then click "Save," it works fine.  It's just when I use the send_keys command to upload the photo that I then can't actually save it.  Any ideas why? Here is the Save button:

<div class="action-btns"><span class="save-btn rounded-btn">Save</span><span class="croppic-cancel white-btn cancel-btn">Cancel</span></div>

Viewing all articles
Browse latest Browse all 98356

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>