Results 1 to 2 of 2

Thread: [RESOLVED] Web scraping in web browser in UserForm

Threaded View

  1. #1

    Thread Starter
    Join Date
    Oct 2018

    Resolved [RESOLVED] Web scraping in web browser in UserForm

    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:

     Application.Wait (Now + TimeValue("0:00:04"))
    After that I am getting an error on .Document.querySelector("[name=import_budgets]").Click. Also web browser is not "refreshing" (moving to next page), I see it has been done .Document.querySelector(".data .a_1_611").Click 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?

       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
        .Document.querySelector(".data .a_1_610").Click
        End If
        Application.Wait (Now + TimeValue("0:00:04"))
    'Unload IE
        If Err <> 0 Then
           MsgBox "There was an error running the code. Check your Internet and VPN connection. Please try one more time!"
        End If
        On Error GoTo 0
    End With
    Name:  Ehz2z.jpg
Views: 94
Size:  21.4 KB
    Last edited by mrwad; Jun 12th, 2019 at 01:39 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Click Here to Expand Forum to Full Width