verifying word opens up inside IE (sharepoint)

Jan 29, 2015 at 8:29 PM
I am trying to automate checking to see if word (or any office document) is opening properly inside IE (sharepoint). My problem is that I can detect when it loads right away and when it doesn't load right away - but I'm having a problem when it starts to load the doc but then times out. My code reports that it loaded successfully, when it doesn't. Is there a better way that I should be approaching this problem? Is there something better for this than Test-UIAControlState?

ipmo .\UIAutomation\UIAutomation.dll
ipmo .\UIAutomation\TMX.dll
Set-StrictMode -Version Latest
$global:Result = "" | out-null
$global:Steps = "" | out-null
[UIAutomation.Mode]::Profile = [UIAutomation.Modes]::Normal;
[UIAutomation.Preferences]::Highlight = $false;
[UIAutomation.Preferences]::HighlightParent = $false;

start-process iexplore "http://sharepoint......

if (Wait-UIAWindow -Name "ISEG Test Document.docx - Internet Explorer" -Seconds 30) {
$Temp = Get-UiaWindow -Class 'IEFrame' -Name 'ISEG Test Document.docx - Internet Explorer'
$Temp = Get-UiaPane -Class 'Frame Tab'
$Temp = Get-UiaPane -Class 'TabWindowClass' -Name 'ISEG Test Document.docx - Internet Explorer'
$Temp = Get-UiaPane -Class 'Shell DocObject View'
$Temp = Get-UiaPane -Class 'Internet Explorer_Server' -Name 'ISEG Test Document.docx'
$Temp = Get-UiaPane -Name 'ISEG Test Document.docx' 

$Result = Test-UIAControlState -searchCriteria @{Name='ISEG Test Document.docx'}
if ($result) {
    write-host "Word loaded inside the browser successfully" -fore green
    $Global:Result = "Working"
    $Global:Steps = "The Word document loaded successfully"
} else { 
    write-host "the document failed to load inside the browser" -fore magenta
    $Global:Result = "Failed"
    $Global:Steps = "The document failed to load inside the browser"
}
Feb 2, 2015 at 6:20 PM
I don't have Sharepoint (lucky me), but I would surmise that checking for the existence of the timeout message might be the right way to go.

You'll have to decide how much time you want to wait for such a message. Or first check the result as you have, then check for timeout...

I found this Microsoft Support page that might be of interest:
Error "Request timed out" when you try to upload a large file to a document library on a Windows SharePoint Services 3.0 site