【问题标题】:Click Through Hover VBA点击悬停VBA
【发布时间】:2023-03-20 21:20:02
【问题描述】:

我已经成功登录了。坚持能够单击悬停图像/文本。我可以使用基本 url 和下面源代码中提供的 href 进行导航,但我必须再次输入登录信息。此外,此 url 导航的页面与 VBA url 具有不同的用户名和密码字段。

请参阅下面的当前 VBA 代码。

    Sub copyshoeprice()

    Dim ie As Object

    Set ie = CreateObject("InternetExplorer.Application")

    With ie

     .Visible = True
     .navigate ("https://data.terapeak.com/verify/")

    While ie.ReadyState <> 4
    DoEvents
    Wend

      ie.document.getelementbyid("username").Value = "xxxxxxxxxx"
      ie.document.getelementbyid("password").Value = "xxxxxxxxxx"

      Set the_input_elements = ie.document.getelementsbytagname("button")
      For Each input_element In the_input_elements
      If input_element.getAttribute("name") = "login" Then
      input_element.Click
       Exit For
       End If
     Next input_element

    End With

    Set ie = Nothing

    End Sub

请查看需要点击的图像/文本的来源。

    <a class="js-features-page usage-logging-enabled" href="page=marketAnalysis" data-page="marketAnalysis" data-access="marketAnalysis">
       <div class="content">
          <div class="icon delayp1">
              <i class="tp-icon-binoculars"></i>
          </div>
       <h3 class="title">
          In-Depth
          <br>
          Research
       </h3>
       <div class="tp-info">
          <span class="choice-text">Analyze products, categories, and trends</span> 
          <span class="Select hidden-sm">Select >> </span>

【问题讨论】:

    标签: javascript html excel vba web-scraping


    【解决方案1】:
    Sub copyshoeprice()
    
    Dim ie As Object
    Dim shoe_name_range As Range
    
    Set ie = CreateObject("InternetExplorer.Application")
    
    
    ie.Visible = True
    ie.navigate ("https://sell.terapeak.com/?page=eBayProductResearch#productResearch/item_browse")
    
    
    Do While ie.readyState <> READYSTATE_COMPLETE
    DoEvents
    Loop
    
    
    Set UserN = ie.document.getElementsByName("username")
    If Not UserN Is Nothing Then
    UserN(0).Value = "xxxxxxxx"
    End If
    
    
    Set PW = ie.document.getElementsByName("password")
    If Not PW Is Nothing Then
    PW(0).Value = "xxxxxxx"
    End If
    
    
    Set the_input_elements = ie.document.getElementsByTagName("input")
    For Each input_element In the_input_elements
    If input_element.getAttribute("name") = "login" Then
    input_element.Click
    Exit For
    End If
    Next input_element
    
    
    Do While ie.readyState <> READYSTATE_COMPLETE
    DoEvents
    Loop
    
    
    PauseTime = 6
    Start = Timer
    Do While Timer < Start + PauseTime
    DoEvents
    Loop
    
    
    Set ElementCol1 = ie.document.getElementsByTagName("li")
    For Each ele1 In ElementCol1
        If ele1.getAttribute("data-i18n") = "DatePicker.NinetyDays" Then
            ele1.Click
    Exit For
    End If
    Next ele1
    
    Set ie = Nothing
    
    End Sub
    

    【讨论】:

      猜你喜欢
      • 2016-11-10
      • 1970-01-01
      • 1970-01-01
      • 2020-12-31
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多