【问题标题】:Autohotkey (AHK) web page select file dialogAutohotkey (AHK) 网页选择文件对话框
【发布时间】:2018-07-13 04:26:47
【问题描述】:

我在网页上有输入,允许选择文件:

<input name="amount_name" class="form-control" id="amount_input" aria-invalid="false" type="text" value="">
<input name="file_name" id="file_path" aria-invalid="false" type="file" value="">
<button class="btn btn-success" id="save_btn" type="submit"></button>

我有文件名。我需要输入这个文件名,就像用户选择它一样,然后按“提交”按钮。我这样做:

amount := 10
file_path := "C:\tmp\1.txt"

    wb := ComObjCreate("InternetExplorer.Application")
    wb.Visible := True
    wb.Navigate("https://example.com")
    ;here i fill one input field, it works
    wb.document.getElementByID("amount_input").value := amount
    ;here i need to fill file name. in this edition it opens dialog, but I cant fill it. if i use .value - it just ignored
    wb.document.getElementByID("file_path").click()
    ;it submits form, work fine
    wb.document.getElementById("save_btn").click()

【问题讨论】:

  • 顺便说一句,如果我从对话框中手动选择文件,那么我可以从 .value 中获取它。但如果我设置 .value,然后读取它 - 它返回空值

标签: autohotkey webpage web-controls


【解决方案1】:

你试过这个吗:

wb.document.getElementByID("amount_input").innerText

【讨论】:

  • 是的,和.value的结果一样,而且两者都一样
猜你喜欢
  • 2011-04-05
  • 2011-04-29
  • 2015-11-29
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2014-04-01
  • 2016-05-03
  • 1970-01-01
相关资源
最近更新 更多