Powershell自动选择网站上的文件

时间:2017-07-04 04:57:19

标签: javascript powershell

我正在尝试自动上传网站上的图片。知道如何让下面的代码工作。我相信doc.getElementById和获取文件本身就是问题。提前致谢

$url = 'https://cubeupload.com/'

# Create the IE com object 
$ie = new-object -com InternetExplorer.Application 

# Wait for the page to finish loading 
do {sleep 1} until (-not ($ie.Busy)) 
$ie.visible = $true #Uncomment this for debugging 

$link = $doc.getElementById('#pickfiles')
$link.click()


Code Block
<FORM>
<INPUT type=file name=attachment>
</FORM>

<script language=javascript>   
  function window.onload(){   
          document.all.attachment.focus();   
          var WshShell=new ActiveXObject("WScript.Shell")   
          WshShell.sendKeys("D:\MyFile.jpg")
  }   
</script>

0 个答案:

没有答案