title: IE source code placeholder control for my VBA scraper
body: <p>I have the following code which opens an IE page, and fills in the fields with the value "caravan". However I only need the first field to be filled in with "caravan". I need the second one to be filled in with "2016" for example. I've had trouble with this task because I can't seem to uniquely identify each element within the input tag (to which all of the fields belong).</p>
  
  <p>Here is my code:</p>
  
  <pre><code>Sub Quote()
  
  
  
  Dim ie As Object
  
  Set ie = CreateObject("InternetExplorer.Application")
  
  ie.navigate ("https://insurance.qbe.com.au/portal/caravan/form/estimate")
  
  ie.Visible = True
  
  Do
  DoEvents
  Loop Until ie.readystate = 4
  
  
  
  Application.Wait (Now + TimeValue("00:00:03"))
  
  Do
  DoEvents
  Loop Until ie.readystate = 4
  
  
  Set inputCollection = ie.document.getElementsByTagName("input")
  
  
  
  For Each inputElement In inputCollection
  
  
  inputElement.Value = "Caravan"
  
  
  Next inputElement
  
  
  Loop
  
  
  End Sub
  </code></pre>
  
  <p>So it's taking each "inputElement" that is housed within the "input" tag, and where possible, it's making a corresponding field's display value be that of "caravan".</p>
  
  <p>To illustrate why I'm having difficulty in uniquely identifying each field, here is the source of the first two fields (first one is for caravan type; second one is for caravan year-of-manufacture):</p>
  
  <p>First one</p>
  
  <p><a href="https://i.stack.imgur.com/VvPdU.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/VvPdU.png" alt="enter image description here"></a></p>
  
  <p>Second one</p>
  
  <p><a href="https://i.stack.imgur.com/ddnc8.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ddnc8.png" alt="enter image description here"></a></p>
  
  <p>So neither have an id. And both are within the "input" tag and both have the same classname. So I can't get-element-by-id or get-elements-by-classname. I've tried getting elements by classname in a wide range of ways and it simply does nothing (no error is produced and the web page isn't affected). </p>
  
  <p>The only way I've managed to fill in a field is through using the code I have above. But, again, it's changing <strong>all</strong> the fields of course. I figure that the only thing I can really use to get my code to tell the two apart is the placeholder element of each one. </p>
  
  <p>But how do I achieve this seeing as you cannot "get element by placeholder" </p>
  
  <p>//</p>
  
  <p>I've since tried to confirm that there's no way to use classname, with the following code modification:</p>
  
  <pre><code>Set inputCollection = ie.document.getElementsByTagName("input")
  
  For Each inputElement In inputCollection
  
  If ie.document.getElementsByClassName.Value = "ui-select-search ui-select-toggle ng-pristine ng-valid ng-touched" Then inputElement.Value = "Caravan"
  </code></pre>