无法锻炼 href Class - 标签

Unable to workout href Class - Tag

我以前从未发过 HTML,所以不确定我是否发对了。我正在尝试从下面的 html 中获取 href。

这是UrlLink

我已经尝试了我的代码的几种变体,从 GetClass GetClass With GetTag "Span"GetClass With GetTag "Span" + "a" 但是我无法计算出 class 是什么。看起来很直接,但是我坚持这个。

<section class="prod-SellerSection bot-border-bottom">
    <div class="Grid-col">
        <div data-tl-id="ProductSellerInfo-ProductSellerInfo" class="SellerInfo">
            <span aria-hidden="true" class="elc-icon xs-margin-right valign-middle elc- icon-spark elc-icon-18"></span>
            <span data-tl-id="ProductSellerInfo-SoldShippedBy" class="SellerInfo-shipping-msg"> <span class="no-wrap">Sold &amp; shipped by</span></span>
            <a class="seller-name" href="https://help.walmart.com/article/shipping-and-delivery-with-walmart-com/0fa824faeca24e599e0e5292a7185336" data-tl-id="ProductSellerInfo-SellerName" tabindex="0">Walmart</a>
            <div class="display-inline-block">
                <button class="button SellerInfo-return-policy button--link" data-automation-id="button" data-tl-id="ProductSellerInfoReturnPolicyModal-ReturnPolicy" type="button"><span class="button-wrapper">Return policy</span></button>
            </div>
        </div>
    </div>
</section>

这是我最新的变体 Class + Span + a

N.B。我已经删除了 class,因为我无法解决它。

For Each link In varLinks
    DoEvents
    Set doc = NewHTMLDocument(CStr(link))
    ''''Get Link 1
    If doc.getElementsByClassName("")(0).getElementsByTagName("Span")(0).getElementsByTagName("a")(0) Is Nothing Then
        wsSheet.Cells(StartRow + myCounter, 2).Value = "-"
    Else
        wsSheet.Cells(StartRow + myCounter, 2).Value = doc.getElementsByClassName("")(0).getElementsByTagName("Span")(0).getElementsByTagName("a")(0).href
    End If

问题)href 元素的正确 class 是什么?

我不需要写代码,我只需要知道变体是什么。我已经按照一个或另一个顺序尝试了所有标签,但我无法计算出正确的顺序。


HTML 图片:

'''################# 更新于今天 17.2.2021 10:30 英国时间 ############# ###

我仍然无法提取 url,这是目前的代码,QHarr 推荐。我确信这是我使用的第一个变体之一。这看起来很简单,但我无法解决。

如果我让代码保持原样,那么它什么也没有

如果我从第一行中删除 (0),则会收到一条错误消息,因此我将其留在了

    StartRow = wsSheet.Cells(wsSheet.Rows.Count, "B").End(xlUp).Row + 1
    EndRow = wsSheet.Cells(wsSheet.Rows.Count, "A").End(xlUp).Row
    varLinks = WorksheetFunction.Transpose(wsSheet.Range("A" & StartRow & ":A" & EndRow))
        
    Counter = 0
    For Each link In varLinks
        Set doc = NewHTMLDocument(CStr(link))
        ''''Get Link 1
        If doc.getElementsByClassName("seller-name")(0) Is Nothing Then
            wsSheet.Cells(StartRow + myCounter, 2).Value = "-"
        Else
            wsSheet.Cells(StartRow + myCounter, 2).Value = doc.getElementsByClassName("seller-name")(0).href
        End If

'######################## 2020 年 2 月 19 日更新############## ##########

现在可以使用了,谢谢 QHarr。由于某种原因,我不得不注销我的电脑并在第二天尝试,现在已修复

现在可以使用了。非常感谢 QHarr。由于某种原因,我不得不注销我的电脑并在第二天尝试,现在已修复

    StartRow = wsSheet.Cells(wsSheet.Rows.Count, "B").End(xlUp).Row + 1
    EndRow = wsSheet.Cells(wsSheet.Rows.Count, "A").End(xlUp).Row
    varLinks = WorksheetFunction.Transpose(wsSheet.Range("A" & StartRow & ":A" & EndRow))
        
    Counter = 0
    For Each link In varLinks
        Set doc = NewHTMLDocument(CStr(link))
        ''''Get Link 1
        If doc.getElementsByClassName("seller-name")(0) Is Nothing Then
            wsSheet.Cells(StartRow + myCounter, 2).Value = "-"
        Else
            wsSheet.Cells(StartRow + myCounter, 2).Value = doc.getElementsByClassName("seller-name")(0).href
        End If