VBA Selenium with Chrome - Upload a file to the WebPage

Viewed 663
  1. I am using VBA to automate Chrome to upload a file to a site, with the button of File type

  2. I have no idea about uploading script in chrome

My current VBA:

Sub UploadFile()
    Dim bot As WebDriver
    Set bot = New WebDriver
    bot.Start "chrome"
    bot.Get "https://tutorialehtml.com/en/html-tutorial-upload-form/"

         '#continue script here please"
End Sub

1 Answers

If there is any input field with attribute type = 'file' you can use the below code :

bot.FindElementByCss("input[type='file']").SendKeys "path of file"
Related