none
Powershell Internet Explorer clicking problem RRS feed

  • Question

  • Hi

    I am trying to write powershell script that logs in website, search, clicks, and changes/writes some values, but I have a problem with hover button.

    $IE = New-Object -ComObject 'InternetExplorer.Application'
    $IE.Visible = $true
    Start-Sleep -Seconds 5
    $IE.navigate("https://")
    Start-Sleep -Seconds 5
    $HomePage = $IE.Document
    #$HomePage.IHTMLDocument3_getElementsByTagName("Input")
    Start-Sleep -Milliseconds 500
    $UserName = $HomePage.IHTMLDocument3_getElementsByTagName("Input") | where-object {$_.name -eq 'UserName'}
    $Password = $HomePage.IHTMLDocument3_getElementsByTagName("Input") | where-object {$_.name -eq 'Password'}
    Start-Sleep -Milliseconds 500
    $SubmitButton = $HomePage.all | Where-Object {$_.tagname -like 'DIV*'} | Where-Object {$_.classname -eq 'SubmitButton'}
    #read-host -assecurestring | convertfrom-securestring | out-file C:\temp\pw.txt
    $pwcheck = get-content C:\temp\pw.txt | convertto-securestring
    $Credential = new-object -typename System.Management.Automation.PSCredential -argumentlist "XXXXXXXXXXXXx", $pwcheck
    Start-Sleep -Milliseconds 500
    $UserName.value = $Credential.UserName
    $Password.value = $credential.GetNetworkCredential().Password
    Start-Sleep -Milliseconds 500
    $SubmitButton.click()
    Start-Sleep -Seconds 5
    
    
    $Search = $HomePage.all | Where-Object {$_.tagname -like 'DIV*'} | Where-Object {$_.classname -eq 'search'} | foreach {$_.children}
    
    Start-Sleep -Seconds 3
    $Search.value = "XXXXXXXXX"
    Start-Sleep -Milliseconds 500
    $SearchButton = $HomePage.all | Where-Object {$_.tagname -like 'DIV*'} | Where-Object {$_.classname -eq 'ButtonGroup ExecuteSearch'} | foreach {$_.children}
    Start-Sleep -Milliseconds 500
    $SearchButton.click()
    Start-Sleep -Seconds 5
    
    
    $frame = ($ie.document.getElementsByTagName("iframe"))[0]
    $Iframe = $frame.contentWindow.document
    
    $TicketNumber = $Iframe.getElementsByTagName("td") | where-object {$_.classname -like 'Text C  U3'} 
    
    Start-Sleep -Seconds 5
    
    $TicketNumber.click()
    Start-Sleep -Seconds 5
    
    $FirstPopUp = New-Object -ComObject Shell.Application
    $NewIE = $FirstPopUp.windows()
    $AccessIE = ($NewIE | Where-Object {$_.LocationName -like "*XXXXXXXX*"}).document
    $AccessIE
    
    
    #$EditButton = $AccessIE.all | Where-Object {$_.tagname -like 'DIV'} | Where-Object {$_.classname -eq 'ToolBarItem Left ButtonGroupStart'} | Where-Object {$_.textcontent -like 'edit'}
    #$EditButton = $AccessIE.all | Where-Object {$_.tagname -eq "SPAN" -and $_.classname -eq "Text" -and $_.innertext -eq "edit"}

    If I move cursor to that button classname changes.
    Button ButtonIcon Edit NormalState with cursor Button ButtonIcon Edit Hoverstate

    Problem is that script won't click that edit button.

    Log in, find, click (that search and opens popup window) works fine but I need few clicks more :D

    I can find edit button but clicking doesn't work.


    • Edited by anonyymne Saturday, February 17, 2018 12:29 PM
    • Moved by jrv Wednesday, October 2, 2019 8:09 PM abandoned
    Saturday, February 17, 2018 12:25 PM

All replies

  • Hi,

    This is a quick note to let you know that I am currently performing research on this issue and will get back to you as soon as possible. I appreciate your patience.

    If you have any updates during this process, please feel free to let me know.

    Best Regards,
    Albert

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

    Monday, February 19, 2018 2:46 PM