none
Input values to textArea element RRS feed

  • Question

  • Hi,

    I have a PowerShell script that open Internet Explorer browser at specific URL.

    I know how to refer to specific elements ant to Input them values (See at the code on the bottom).

    But when I used this code on textArea, the data I am enter isn't inserted to the textArea.

    PLS help me.

    thanks in advance

    $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

    Tuesday, November 29, 2016 2:24 PM

All replies

  • Try:

    $IE.Document.getElementById($messageBoxID).innerText =$messageToSend


    \_(ツ)_/

    Tuesday, November 29, 2016 6:19 PM
    Moderator
  • thanks, But this does not work either.

    when I use innerText or value, what is actually happen is that only the text older changes and not the data.

    Any idea?

    Wednesday, November 30, 2016 6:18 AM
  • I found solution to the problem

    I need to use the focus() before I am changing the value tag...

    Wednesday, November 30, 2016 10:38 AM
  • Hi,

    Glad to hear it works!

    Please remember to mark useful reply as answer, so that it would be much more efficient for other forum community members to find useful information.

    Best Regards,

    Amy


    Please remember to mark the replies as answers if they help.
    If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.

    Friday, December 2, 2016 3:14 AM
    Moderator
  • Hi,

    Could you please help me with this.

    Facing the same problem.

    I want to set value of the textaea, however in doing so I am getting error :-

    Error Details :- Exception setting "value": "The property 'value' cannot be found on this object. Verify that the property exists and can be set.


    • Edited by DivyaMah Friday, July 10, 2020 3:13 PM
    Friday, July 10, 2020 12:15 PM