【问题标题】:Data extraction using Selenium in MS access vba在 MS access vba 中使用 Selenium 进行数据提取
【发布时间】:2021-09-21 14:14:16
【问题描述】:

我目前在 MS Access vba 中使用下面提到的代码,代码正在提取主类数据但不提取子类数据,因为在执行过程中可以看到需要对象的错误。我的代码如下。

Const URL As String = "https://www.tmdn.org/tmview/#/tmview/results?page=1&pageSize=30&criteria=C&basicSearch=Bolígrafo"
Dim myproduct As Selenium.WebElement
Set d = New ChromeDriver
With d
.Start "Chrome"
.Get URL
Sleep 40000
Dim element As Selenium.WebElement
Dim elements As Selenium.WebElements
Set elements = .FindElementsByCss("div[class=rt-tr-group]")
For Each element In elements
trade = element.FindElement(By.className("sc-pZopv gQWHwO")).Text
Next element
MsgBox (trade)

【问题讨论】:

    标签: vba selenium-webdriver ms-access-2013


    【解决方案1】:

    您的“Sleep 40000”行可能不够用。 由于 Internet 响应时间可能有很大差异 - 这种绝对时间机制不是确保 Web 内容“完全加载/检索”的可靠方法。 您需要研究确保网页“完全加载”的其他方法。

    【讨论】:

    • 好的..但我在完成加载后遇到错误。
    • 问题不在于睡眠,实际上问题在于以下行元素。FindElement(By.className("sc-pZopv gQWHwO")).Text
    猜你喜欢
    • 1970-01-01
    • 2020-12-16
    • 1970-01-01
    • 2012-01-23
    • 2015-10-27
    • 1970-01-01
    • 1970-01-01
    • 2014-02-14
    • 1970-01-01
    相关资源
    最近更新 更多