我在网页上输入,允许选择文件:
<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()
答案 0 :(得分:0)
你试过这个:
wb.document.getElementByID("amount_input").innerText