1

I am using selenium with java script and i can't upload files from local machine. I tried using 'upload.sendKeys(direction from file)', but does not work. When i clicking on the upload button and open a window to select a file from local machine i don't know how i can select a file.

await findByCss(driver, selectContent).click();

await delay();

var upload = findByCss(driver, selectContent);

upload.sendKeys("C:/trabajo/Pineapple-lab/para docola/Actualidad_356226259_107392298_1024x576.jpg"); 

await delay();
H.B.
  • 166,899
  • 29
  • 327
  • 400

1 Answers1

0

If i remember correctly one should not issue a click and send the path directly (because the click will open a dialog that Selenium cannot interact with). Of course you also need some way of handling the file, either a form to send it or a change handler on the input itself.

H.B.
  • 166,899
  • 29
  • 327
  • 400