Python Forum
Upload image to Instagram using python/selenium using image URL failed, need help
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Upload image to Instagram using python/selenium using image URL failed, need help
#1
Hello;
I try to post images to Instagram using python selenium, but when I want to use the image URL I get an error.
when I use an absolute path to the image file from my computer it works and the image is submitted,
Appreciate your help on this.

this is snipet of code I used:

from selenium import webdriver
post_image = ser.find_element(By.XPATH, "//div[contains(@class,'_C8iK')]//input[contains(@type,'file')]")
post_image.send_keys("C:\\Users\\myName\\Desktop\\images\\image-1.jpg")
but when I try to image URL which is stored in dropbox share folder, it does not work,
example:
post_image = ser.find_element(By.XPATH, "//div[contains(@class,'_C8iK')]//input[contains(@type,'file')]")
post_image.send_keys("https://www.dropbox.com/s/fe16a48r2l2wzvh/apple.jpg")
I have tried it on my computer, running windows 7 64 bit, python 3.8, selenium 4.1.0
when I run with image URL I get the error: path is not absolute

I also tested it on pythonanywhere, the first method worked over there as well, when I put the image on pythonanywhere, but when using image URL from dropbox I get this error:
selenium.common.exceptions.InvalidArgumentException: Message: invalid argument: File not found : https://www.dropbox.com/s/fe16a48r2l2wzvh/apple.jpg
(Session info: headless chrome=90.0.4430.212)
Reply


Messages In This Thread
Upload image to Instagram using python/selenium using image URL failed, need help - by greenpine - Feb-22-2022, 11:32 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
Photo image error pyc0de 2 377 Mar-23-2024, 06:20 PM
Last Post: pyc0de
  Using OpenCV and image path is invalid AudunNilsen 5 722 Mar-18-2024, 05:28 PM
Last Post: snippsat
  Count image's colors very fast flash77 18 2,015 Mar-05-2024, 06:12 PM
Last Post: deanhystad
  Convert numpy array to image without loading it into RAM. DreamingInsanity 7 6,127 Feb-08-2024, 09:38 AM
Last Post: paul18fr
  error "cannot identify image file" part way through running hatflyer 0 802 Nov-02-2023, 11:45 PM
Last Post: hatflyer
  Failed attempts to load Microsoft Appstore Python DLLs piyushd 0 520 Oct-31-2023, 10:43 AM
Last Post: piyushd
  Mirror Video Image in realtime makingwithheld 1 515 Oct-30-2023, 02:45 PM
Last Post: Larz60+
  howto get size of a ctk image? janeik 2 1,006 Oct-03-2023, 03:49 AM
Last Post: janeik
  Use of PIL.Image nafshar 12 2,428 Sep-07-2023, 11:02 PM
Last Post: nafshar
Question image manipulation (cropping and MetaData) SpongeB0B 4 1,273 Jul-03-2023, 06:35 PM
Last Post: SpongeB0B

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020