excel - VBA Selenium with Chrome - 将文件上传到网页
问题描述
我正在使用
VBA
自动Chrome
将文件上传到站点,button
类型File
为我不知道在 chrome 中上传脚本
我当前的 VBA:
Sub UploadFile()
Dim bot As WebDriver
Set bot = New WebDriver
bot.Start "chrome"
bot.Get "https://tutorialehtml.com/en/html-tutorial-upload-form/"
'#continue script here please"
End Sub
解决方案
如果有任何带有属性的输入字段,type = 'file'
您可以使用以下代码:
bot.FindElementByCss("input[type='file']").SendKeys "path of file"