title: AutoIt Firefox Automation - _FFClick doesn't work on buttons anymore? (FF.au3)
body: <p>Help! I had AutoIt code that would do the following:</p>
  
  <ol>
  <li><strong>load a page in FireFox</strong>, then </li>
  <li><strong>click on the 'browse' button,</strong> then </li>
  <li><strong>waits for the File Upload window to appear</strong></li>
  </ol>
  
  <p>This code worked great and I used it many times! Now, <strong><em>about a month later, it stopped working</em></strong>. I checked the HTML page and it did NOT change, and the id is the same. </p>
  
  <p>Here are some resources:</p>
  
  <ul>
  <li><a href="http://english.documentation.ff-au3.thorsten-willert.de/ff_functions/_FFOpenURL.php" rel="nofollow">_FFOpenURL</a></li>
  <li><a href="http://english.documentation.ff-au3.thorsten-willert.de/ff_functions/_FFLoadWait.php" rel="nofollow">_FFLoadWait</a></li>
  <li><a href="http://english.documentation.ff-au3.thorsten-willert.de/ff_functions/_FFClick.php" rel="nofollow">_FFClick</a></li>
  <li><a href="https://www.autoitscript.com/autoit3/docs/functions/WinWaitActive.htm" rel="nofollow">WinWaitActive</a></li>
  <li><a href="https://www.autoitscript.com/autoit3/docs/functions/ControlClick.htm" rel="nofollow">ControlClick</a></li>
  <li><a href="http://english.documentation.ff-au3.thorsten-willert.de/" rel="nofollow">Full list of FF.au3 functions</a></li>
  </ul>
  
  <p>Here is the <strong>HTML that I am trying to access</strong>. I am trying to click on <code>#filename</code></p>
  
  <pre class="lang-html prettyprint-override"><code>&lt;fieldset&gt;
      &lt;legend&gt;Import step one: upload Word Document&lt;/legend&gt;
      &lt;h2&gt;Import Word Document: Upload&lt;/h2&gt;
      &lt;div class="field-group"&gt;
           &lt;div class="checkbox/radio"&gt;
                &lt;label for="filename"&gt;Upload:&lt;/label&gt;
                &lt;input id="filename" name="filename" size="50" "="" type="file"&gt;
           &lt;/div&gt;
       &lt;/div&gt;
       &lt;input class="text hidden" name="pageId" value="158367782"&gt;
        &lt;div class="buttons-container"&gt;
             &lt;div class="buttons"&gt;
                  &lt;span class="word-file-loading hidden" id="loading"&gt;Loading&lt;/span&gt;
                  &lt;input disabled="disabled" id="next" name="submit" value="Next" class="button" type="submit"&gt;
             &lt;/div&gt;
        &lt;/div&gt;
  &lt;/fieldset&gt;
  </code></pre>
  
  <p>Here's my <strong>simplified AutoIt code</strong> that should press the <code>#filename</code> button:</p>
  
  <pre class="lang-vb prettyprint-override"><code>; 1) OPEN THE PAGE (WORKS) (I changed the URL)
      _FFOpenURL("http://..../")
  
  ; 2) WAIT FOR PAGE TO LOAD (WORKS)
      _FFLoadWait()
  
  ; 3) SLEEP FOR 5 SECONDS (WORKS)
      Sleep(5000)
  
  ; 4) CLICK THE BROWSE BUTTON (FAILS)
  ;    (SAYS IT IS A SUCCESS BUT THE BUTTON NEVER GETS PRESSED!!)
      _FFClick("filename", "id")
  
  ; 5) WAIT FOR "FILE UPLOAD" WINDOW TO APPEAR (FAILS)
  ;    (FAILS BECAUSE BUTTON NEVER GOT PRESSED ABOVE)
      Local $result = WinWaitActive("File Upload","",10) 
  </code></pre>
  
  <p>Here is my <strong>full autoit code</strong> that should press the <code>#filename</code> button:</p>
  
  <pre class="lang-vb prettyprint-override"><code>; 1) OPEN THE PAGE (WORKS)
      If _FFOpenURL("http://..../") Then
          FileWrite($log,"[INFO] Opened Page successfully." &amp; @CRLF)
      Else
         FileWrite($log,"[ERROR] Could not open Page." &amp; @error &amp; " Extended Error Code = " &amp; @extended  &amp; @CRLF)
         MsgBox(0, "Error", "Could not open Page.")
         Exit
      EndIf
  
  ; 2) WAIT FOR PAGE TO LOAD (WORKS)
      If _FFLoadWait() Then
          FileWrite($log,"[INFO] Waited to open page successfully." &amp; @CRLF)
      Else
          FileWrite($log,"[ERROR] Could not wait for Page." &amp; @error &amp; " Extended Error Code = " &amp; @extended  &amp; @CRLF)
          MsgBox(0, "Error", "Could not wait for Page.")
          Exit
      EndIf
  
  ; 3) SLEEP FOR 5 SECONDS 
      Sleep(5000)
  
  ; 4) CLICK THE BROWSE BUTTON 
  ;    (SAYS IT IS A SUCCESS BUT THE BUTTON NEVER GETS PRESSED!!)
      ;Click the "Choose File" button
      If _FFClick("filename", "id") Then
          FileWrite($log,"[INFO] Clicked the 'browse' button successfully." &amp; @CRLF)
      Else
          FileWrite($log,"[ERROR] Could not click the 'browse' button." &amp; @error &amp; " Extended Error Code = " &amp; @extended  &amp; @CRLF)
          MsgBox(0, "Error", "Could not click the 'browse' button.")
          Exit
      EndIf
  
  ; 5) WAIT FOR "FILE UPLOAD" WINDOW TO APPEAR
  ;    (FAILS BECAUSE BUTTON NEVER GOT PRESSED ABOVE)
  
      ;Wait for the file upload dialog to appear
      Local $result = WinWaitActive("File Upload","",10) ;Wait 10 seconds for "File Upload" window to appear
      If $result == 0 Then
         FileWrite($log,"[ERROR] Waited for 'File Upload' to show, but it never did. " &amp; @error &amp; " Extended Error Code = " &amp; @extended  &amp; @CRLF)
         MsgBox(0, "Error", " Waited for 'File Upload' to show, but it never did. ")
         Exit
      Else
         FileWrite($log,"[INFO] Opened 'File Upload' dialog successfully. " &amp; @CRLF)
      EndIf
  </code></pre>
  
  <p>Here is the errors shown from the Scite console (I replaced the URL):</p>
  
  <pre><code>_FFOpenURL: http://...
  __FFSend: try{window.content.top.document.location.href='http://...'}catch(e){'_FFCmd_Err';};
  __FFRecv: http://...
  _FFLoadWait: ....... loaded in 1688ms
  [object HTMLDocument] - {pagetreesearchform: {...}, location: {...}, getElementsByName: function() {...}, getItems: function() {...}, open: function() {...}, close: function() {...}, write: function() {...}, ...}
  __FFSend: FFau3.WCD=window.content.top.document;
  __FFRecv: [object HTMLDocument] - {pagetreesearchform: {...}, location: {...}, getElementsByName: function() {...}, getItems: function() {...}, open: function() {...}, close: function() {...}, write: function() {...}, ...}
  [object HTMLDocument] - {pagetreesearchform: {...}, location: {...}, getElementsByName: function() {...}, getItems: function() {...}, open: function() {...}, close: function() {...}, write: function() {...}, ...}
  _FFLoadWait: . loaded in 83ms
  [object HTMLDocument] - {pagetreesearchform: {...}, location: {...}, getElementsByName: function() {...}, getItems: function() {...}, open: function() {...}, close: function() {...}, write: function() {...}, ...}
  __FFSend: try{FFau3.simulateEvent(FFau3.WCD.getElementById('filename'),'MouseEvents','click');}catch(e){'_FFCmd_Err';};
  __FFRecv: 1
  _FFLoadWait: . loaded in 11ms
  [object HTMLDocument] - {pagetreesearchform: {...}, location: {...}, getElementsByName: function() {...}, getItems: function() {...}, open: function() {...}, close: function() {...}, write: function() {...}, ...}
  +&gt;11:56:43 AutoIt3.exe ended.rc:0
  +&gt;11:56:43 AutoIt3Wrapper Finished.
  </code></pre>
  
  <p>And here is my version information:</p>
  
  <ul>
  <li><a href="https://www.autoitscript.com/site/autoit/downloads/" rel="nofollow">AutoIt</a> v3.3.14.2</li>
  <li><a href="https://www.autoitscript.com/site/autoit-script-editor/downloads/" rel="nofollow">SciTE</a> v3.6.0</li>
  <li>Firefox v44.0.2</li>
  <li><a href="https://www.autoitscript.com/forum/topic/167661-ffau3-v0601b-15/" rel="nofollow">Firefox AutoIt Plugin</a> - FF V0.6.0.1b-15.au3 (<a href="http://english.documentation.ff-au3.thorsten-willert.de/" rel="nofollow">Docs</a>)</li>
  <li>Firefox Plugin for using AutoIt - <a href="https://github.com/bard/mozrepl" rel="nofollow">MozRepl</a> 1.1.2.1</li>
  </ul>