我在加载的网页上有一个 input type=text 输入框,我填充值后点击提交按钮,一切都正常。
$ie=New-Object -comobject InternetExplorer.Application
$ie.visible=$true
$ie.Navigate("https://myurl/test.html")
while($ie.busy){Start-Sleep 1}
$ie.Document.getElementById("field_firstName").value="Firstname"
$ie.Document.getElementById("field_lastName").value="Lastname"
$ie.Document.getElementById("btn_upload").Click()
while($ie.busy){Start-Sleep 1}
I d also like to populate a input type=file box with c: emp est.txt and upload this. I read that because of security reasons the value= is not supported from the browsers.
Is there any workaround to do this with PowerShell? Maybe "click" the browse button and select the file or use sendkeys?