尝试使用vba

时间:2019-11-22 13:24:06

标签: excel vba google-chrome

我正在尝试使用vba将CSV导入chrome网页中。对此还算陌生,但是通过阅读其他类似的问题,我相当确定可以做到。 我已经使用

打开了正确的网页
    Sub import_test()
Dim Website As String
Dim exepath As String
Dim i As Integer
exepath = "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe"
    Website = ("https://website.com")
    Shell (exepath & " -new-tab " & Website)
    driver.FindElementByXPath("//button[@class='btn-medium btn-alt form-file-btn' and text()='Browse...']").Click
End Sub

如您所见,我试图单击一个名为“浏览”的按钮;该部分的html是:

<span class="l-inline-col" style="width: 110px;">
      <a class="btn-medium btn-alt form-file-btn">
        Browse… <input type="file" name="import_file" id="import_file_1" accept=".csv, text/csv">
      </a>
    </span>

那是行不通的,我不确定下一步要去哪里。对此进行排序后,我想在其弹出的框中粘贴文件路径,然后单击另一个名为import的按钮。

这一切可能吗?也许只是其中的一部分?

0 个答案:

没有答案