(Solved) – vba optimizing with chromedriver

Public Sub GetIndfo()
Dim d As WebDriver, ws As Worksheet, clipboard As Object, writeOutColumn As Long
writeOutColumn = 1
Const URL = "http://comp.wisereport.co.kr/company/c1030001.aspx?cmp_cd=005930&cn="

Set d = New ChromeDriver
Set ws = ThisWorkbook.Worksheets("Sheet3")
Set clipboard = GetObject("New:{1C3B4210-F441-11CE-B9EA-00AA006B1A69}")

With d
    .Start "Chrome"
    .get URL

    Dim links As Object, i As Long
    Set links = .FindElementsByCss("[id*=rpt_tab]")

    For i = 1 To links.Count
        If i > 0 Then
            Loop While Not .ExecuteScript("return jQuery.active == 0")
        End If
        Dim table As Object

        Set table = .FindElementsByCss("[id*=fabG05RlB6cn]")
        clipboard.SetText table.Attribute("outerHTML")

        'ws.Cells(1, writeOutColumn).PasteSpecial
        'writeOutColumn = writeOutColumn   table.FindElementByTag("tr").FindElementsByTag("td").Count   2
        Set table = Nothing
End With
End Sub

The error is assumed to be occurring here.

Set table = .FindElementsByCss("[id*=fabG05RlB6cn]")
clipboard.SetText table.Attribute("outerHTML")

I don’t know what causes the error in coding. If not, which part should I modify? And how do I code to read the results into an array or xmldoc? I’m not familiar with ChromeDriver yet, so I’m having a lot of trouble coding it, so thanks for the detailed help, I’d really appreciate it.

I want this result.
enter image description here

Leave a Reply

Your email address will not be published. Required fields are marked *