excel - VBA Selenium with Chrome - 将文件上传到网页

标签 excel vba selenium

  1. 我正在使用 VBA 自动执行 Chrome,通过 File 的 button 将文件上传到网站 类型

  2. 我不知道如何在 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"

关于excel - VBA Selenium with Chrome - 将文件上传到网页,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/67659124/

相关文章:

vba - IF FIND 函数在 vba 中找不到任何内容

java - 在 Gmail 中,Selenium 有时会在不同区域返回 WebDriverException

testing - 如何单击 Selenium 2 中的弹出式日历向导?

vba - 在 Excel 中,如何生成行 X 次的副本?

javascript - 使用 Excel 数据加载数组并返回它

VBA - 删除不包含特定值的行

python-2.7 - Selenium Python 运行多个测试用例如何登录一次并使用相同的实例浏览器

java - HSSFSheet POI API Java 不会用颜色填充所有列

excel - 除以零处理excel

listbox - Excel VBA : Listbox