locked
Internet Explorer Object failing to "click" [Powershell] RRS feed

  • Question

  • Hello,

    Thanks for passing by, i'm trying to automate a process by adding some parameters to a web page. 

    Adding values, or changing them is no problem however when i try to click on the button it won't do anything even the method is there! 

    Code: 

    PS C:\> $ie.document.IHTMLDocument3_getElementsByTagName('input') | Where-Object {$_.type -eq 'submit' -and $_.Name -eq 'ctl00$MainContent$BtSearch'} | gm
    
    
       TypeName: System.__ComObject#{3050f57d-98b5-11cf-bb82-00aa00bdce0b}
    
    Name                         MemberType Definition                                                     
    ----                         ---------- ----------                                                     
    addBehavior                  Method     int addBehavior (string, Variant)                              
    addFilter                    Method     void addFilter (IUnknown)                                      
    appendChild                  Method     IHTMLDOMNode appendChild (IHTMLDOMNode)                        
    applyElement                 Method     IHTMLElement applyElement (IHTMLElement, string)               
    attachEvent                  Method     bool attachEvent (string, IDispatch)                           
    blur                         Method     void blur ()                                                   
    clearAttributes              Method     void clearAttributes ()                                        
    click                        Method     void click ()   

    Invoking the method will return:

    ($ie.document.IHTMLDocument3_getElementsByTagName('input') | Where-Object {$_.type -eq 'submit' -and $_.Name -eq 'ctl00$MainContent$BtSearch'}).click()
    System.__ComObject

    Is this some kind of security limitation like they say on some forums, or I'm doing something wrong.

    If this is a limitation i will go with send-keys but if not i would like to avoid it since i need the window to be opened on front.

    Thanks in advance for your time. 

    AT


    • Edited by TamboleoA Friday, December 20, 2019 3:04 PM
    Friday, December 20, 2019 3:03 PM