title: How to post image on facebook by using selenium chrome webdriver and vba?
body: <p>I am very new to Selenium and I'm trying to create an application, which gets some information from an excel sheet, logs into a specific facebook page (not a person's profile), and creates a post which contains an image.</p>
  <p>So far I've managed to log into the page account but I have no clue on how to upload a certain image due to the fact that it seems that the webdriver cannot interact with the filedialog that appears if I (programmatically) click on the &quot;upload image&quot; button. Also I cannot find any &quot;upload&quot; id or whatsoever.</p>
  <p>Posting here the code I need help with:</p>
  <pre><code>' After having logged in, this creates a post
  
  Dim ele As WebElement
  Dim drv As New WebDriver
  
  Set ele = drv.FindElementByXPath(&quot;//*[@aria-label='Crea un post']&quot;) ' This selects the &quot;create a new post&quot; button
  ele.Click
  Application.Wait (100)
  If Not IsEmpty(Cells(24, 2)) Then ' Adds picture if there is one specified in the excel sheet
      Set ele = drv.FindElementByXPath(&quot;//*[@aria-label='Foto/video']&quot;) ' This clicks the &quot;add Picture&quot; button, but then the FileDialog appears and I cannot interact with it
      ele.Click
      ele.SendKeys &quot;C:\mytestimage.png&quot;
  End If
  Set ele = drv.FindElementByXPath(&quot;//*[@aria-label='Scrivi qualcosa a mypage']&quot;) ' Italian for &quot;write something to mypage&quot;
  ele.SendKeys &quot;Whatever I want to be written in the post&quot;
  </code></pre>