Using internetexplorer object what is the correct way to wait for an ajax response?

前端 未结 1 1635
别跟我提以往
别跟我提以往 2021-01-25 23:31

I tried to upload a file to a sharepoint library, my code fails to properly detect if ie is still waiting for an ajax response or not. What is the proper way to do this ?

相关标签:
1条回答
  • 2021-01-26 00:06

    ok here is how I've done : the trick was to look each iframes, select the one with the correct location

    for($i=0;$i -lt $ie.Document.frames.length;$i++){
                if( $ie.Document.frames.item($i).location.href -match 'upload.aspx' ){ $frm=$ie.Document.frames.item($i)}
        }
    

    then wait for my input to show

    while( ($frm.document.body.getElementsbytagname("input") |?{$_.type -eq 'file'}) -eq $null){
        echo "waiting ..."
        start-sleep -milliseconds 100
    }
    
    0 讨论(0)
提交回复
热议问题