title: UserForm WebBrowser web scraping
body: <p>I have web browser in UserForm and would like to automate the procedure for button in UserForm. So once user clicks button on UserForm with browser window code should do web scraping. This works if it is not in UserForms web browser. So now when this is inside UserForm it does the code until: </p>
  
  <pre><code>    Application.Wait (Now + TimeValue("0:00:04"))
  
      .Document.querySelector("[name=import_budgets]").Click
  </code></pre>
  
  <p>After that I am getting an error on <code>.Document.querySelector("[name=import_budgets]").Click</code>. Also web browser is not "refreshing" (moving to next page), I see it has been done <code>.Document.querySelector(".data .a_1_611").Click</code> and moved to next page only after receiving an error. Web browser do operations but they are not visible to user, probably that's why it can't proceed to next operation. How to make this work correct?</p>
  
  <pre><code>   With LCountry.WebBrowser1
  
      Application.Wait (Now + TimeValue("0:00:02"))
  
      If ThisWorkbook.Sheets("Other Data").Range("AL21").Value = 2 Then
  
      .Document.querySelector(".data .a_1_611").Click
  
      Else
  
      .Document.querySelector(".data .a_1_610").Click
  
      End If
  
      Application.Wait (Now + TimeValue("0:00:04"))
  
      .Document.querySelector("[name=import_budgets]").Click
  
  'Unload IE
  
      If Err &lt;&gt; 0 Then
  
         MsgBox "There was an error running the code. Check your Internet and VPN connection. Please try one more time!"
         Else
  
      End If
  
      On Error GoTo 0
  End With
  </code></pre>