locked
Javascript window input RRS feed

  • Question

  • In PowerShell, how can I enter input into a window that has been opened via a javascript link for testing?  Below is an example of what I mean.  In addition, can the audio be enabled within the window?

    $List = ('https://ceciva.uscis.dhs.gov/Alme/')
    foreach ($i in $List) {
    
    $ie = new-object -com internetexplorer.application
    $ie.visible=$true
    $ie.navigate($i)
    while($ie.busy) {sleep 3}
    
    $link = $ie.Document.getElementsByTagName('A') | Where-Object {$_.href -match $i} 
        $link.click()
        sleep 3
    
    $link = $ie.Document.getElementsByTagName('A') | where-object {$_.href -match "javascript:void 0"}
        $link.click()
        sleep 3
    }

    Wednesday, July 12, 2017 3:10 PM

Answers

  • You can't because the JavaScript is being called.  There is really no link to call.  JavaScript looks at your page and determines how to dispatch the click.  The form gets the click and the name of the control and performs the link.  There is no default method for doing this.  One of the reasons for this is to prevent exactly what you are trying to do.


    \_(ツ)_/

    • Marked as answer by B3ach B0Y Wednesday, July 12, 2017 8:33 PM
    Wednesday, July 12, 2017 4:07 PM

All replies

  • You can't because the JavaScript is being called.  There is really no link to call.  JavaScript looks at your page and determines how to dispatch the click.  The form gets the click and the name of the control and performs the link.  There is no default method for doing this.  One of the reasons for this is to prevent exactly what you are trying to do.


    \_(ツ)_/

    • Marked as answer by B3ach B0Y Wednesday, July 12, 2017 8:33 PM
    Wednesday, July 12, 2017 4:07 PM
  • Could PowerShell let me "focus" on the text box and send text to the window or is this what you are saying there is no default method for doing this either?
    Wednesday, July 12, 2017 7:51 PM
  • Maybe if the textbox really exists.  Just set its "Value" member and if it is not an Ajax textbox it should show on the screen.


    \_(ツ)_/

    Wednesday, July 12, 2017 8:00 PM