【发布时间】:2020-03-02 16:16:15
【问题描述】:
我在网站上打开文件夹选择器时遇到问题,要求我上传图片。我可以登录网站,可以打开浏览链接显示的链接,也可以点击它。但是,我无法上传已知位置,也无法单击上传按钮。链接在 fw 后面,所以所有链接都被隐藏了。
Dim ie As New InternetExplorer
Dim myElem As Variant
ie.Visible = True
With ie
Const MAX_WAIT_SEC As Long = 10
Dim t As Date, ele As Object
t = Timer
While .Busy Or .readyState < 4: DoEvents: Wend
End With
ie.document.getElementById("picture").Click
'this cell contains picture link
Sheets("picture").Range("A12").Copy
With ie
While .Busy Or .readyState < 4: DoEvents: Wend
End With
ie.document.getElementById("browse").Click
With ie
While .Busy Or .readyState < 4: DoEvents: Wend
End With
'folder picker is active now and code should be written here
With ie
While .Busy Or .readyState < 4: DoEvents: Wend
End With
ie.document.getElementById("upload").Click
End With
手动,我可以使用 ctrl+v 然后输入,它可以工作,但是使用宏我使用下面的代码,对我不起作用。
SendKeys "^v", True
SendKeys "enter", True
还没有解决,感谢您的帮助。
【问题讨论】:
-
@sam 感谢您的链接,但我已经看到并测试了它。不幸的是,文件夹选择器屏幕没有任何效果。
标签: vba web-scraping sendkeys