Feb-22-2022, 11:32 AM
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:
example:
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)
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)