【问题标题】:automatically choose picture from known location with folder picker on website使用网站上的文件夹选择器自动从已知位置选择图片
【发布时间】: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

还没有解决,感谢您的帮助。

【问题讨论】:

标签: vba web-scraping sendkeys


【解决方案1】:

这不是您发送 ENTER 键的方式。见MSDN Guidance

SendKeys "~", True '// Send {ENTER} key

目前您字面意思将文本 "enter" 发送到窗口。

【讨论】:

  • 我之前的问题是;我无法将位置粘贴到文件夹选择器屏幕。顺便感谢您的输入。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2019-05-01
  • 1970-01-01
  • 1970-01-01
  • 2012-07-06
  • 2014-09-03
相关资源
最近更新 更多