how do i upload image in a text box (without the upload button) using selenium python

  base64, python, selenium


I am trying to upload images (mostly PNG) into a text box (wherre the text box does not have an upload button) using selenium-python

manually the job is done by following method:

Manually to copy images into a text box online, i used to first insert the image into ms word and then copy the image from there and paste it into the text box online.

Solutions tired for doing the above job automatically using selenium:

first I added some random image manually in the text box, After double clicking on the image a dailog box appeared

[Image of the dailog box that appeared by double clicking] :

the url section had the base64 encoding of the image. so i tired uploading the new image in the url section (that appeared by double clicking on the random image uploaded manually) as text by converting it into base64 and then uploading the whole string at once it, but the browser froze. ( Maunally when done, it worked really well)

then i broke the string in intervals of 100 or one at a time and then uploaded it, both worked but took like 20 -30 mins to upload one.

Is there any better and faster solution to this???

Any solution/suggestion is highly appriciated.

Thank you in Advance,


Source: Python Questions