使用PowerShell为IE上的textArea输入值

使用PowerShell为IE上的textArea输入值,powershell,Powershell,我有一个PowerShell脚本,可以在特定URL打开Internet Explorer浏览器。 我知道如何引用特定的元素ant,以便在文本框中输入值(请参见底部的代码) 但当我在textArea上使用此代码时,输入的数据不会插入textArea 请帮帮我 提前谢谢 $userNameID = "ctl00_MainContent_login_control_UserName" $passwordID = "ctl00_MainContent_login_control_Password" $

我有一个PowerShell脚本,可以在特定URL打开Internet Explorer浏览器。 我知道如何引用特定的元素ant,以便在文本框中输入值(请参见底部的代码)

但当我在textArea上使用此代码时,输入的数据不会插入textArea

请帮帮我

提前谢谢

$userNameID = "ctl00_MainContent_login_control_UserName"
$passwordID = "ctl00_MainContent_login_control_Password"

$loginButton = "ctl00_MainContent_login_control_LoginButton"
$phonesID = "ctl00_MainContent_reciSel_TabsContacts_tabFromFile_txtFromFile"
$sendSmsButton = "ctl00_MainContent_btn_SaveAndSave"
$messageBoxID = "ctl00_MainContent_txt_ContentText"
$confirmButton = "ctl00_MainContent_ButtonOk"

$IE=new-object -com internetexplorer.application
$IE.visible = $true
$IE.navigate2("myUrl")
while($IE.Busy) { Start-Sleep -Milliseconds 100 }

**#this works on this element:**
$IE.Document.getElementByID($userNameID).value = "user name" 
**#this works on this element:**
$IE.Document.getElementByID($passwordID).value= "password"

$IE.Document.getElementByID($loginButton).Click()
while($IE.Busy) { Start-Sleep -Milliseconds 100 }

**#Does not work on this element:**
$IE.Document.getElementById($messageBoxID).value = $messageToSend