TestStack / White

DEPRECATED - no longer actively maintained
Other
1.02k stars 486 forks source link

Not able to retrieve a winForm window from a WPF application during splashScreen #615

Closed Sl1ckR1ck closed 6 years ago

Sl1ckR1ck commented 6 years ago

Hi all,

ok this may be a twisted case, but in our application we have a validation process that occurs during the Application.xaml.vb OnStartup method.

Basically if the validation fails we use a legacy Windows Form message (from another library) to show a error message and then close the application after the user clicked OK.

The problem is that this WindowsForms is nowhere to be found.

If i look in _application.GetWindows there is 0 windows.

If i look in TestStack.White.Desktop.Instance.Windows, none of those windows if my window desired.

Also this winForm window is not shown in the task manager since it is part of the application process.

With Microsoft UI Test Recorder, i am able to find the control and replay my tests.

Any clues of what is wrong? Am i doing something wrong?

Sl1ckR1ck commented 6 years ago

As stated the window is able to be found with Microsoft UI Test Builder and can be replayed.

This auto-generated code may help: ` <GeneratedCode("Coded UITest Builder", "15.0.26208.0")> _ Public Class UIValidationWindow Inherits WinWindow

    Public Sub New()
        MyBase.New
        Me.SearchProperties(WinWindow.PropertyNames.Name) = "Validation Window Title"
        Me.SearchProperties.Add(New PropertyExpression(WinWindow.PropertyNames.ClassName, "WindowsForms10.Window", PropertyExpressionOperator.Contains))
        Me.WindowTitles.Add("Validation Window Title")
    End Sub

    #Region "Properties"
    Public ReadOnly Property UIValidationTitleBar() As WinTitleBar
        Get
            If (Me.mUIValidationTitleBar Is Nothing) Then
                Me.mUIValidationTitleBar = New WinTitleBar(Me)
                Me.mUIValidationTitleBar.WindowTitles.Add("Validation Window Title")
            End If
            Return Me.mUIValidationTitleBar
        End Get
    End Property

    Public ReadOnly Property UITxtMessageWindow() As UITxtMessageWindow
        Get
            If (Me.mUITxtMessageWindow Is Nothing) Then
                Me.mUITxtMessageWindow = New UITxtMessageWindow(Me)
            End If
            Return Me.mUITxtMessageWindow
        End Get
    End Property

    Public ReadOnly Property UIItemWindow() As UIItemWindow
        Get
            If (Me.mUIItemWindow Is Nothing) Then
                Me.mUIItemWindow = New UIItemWindow(Me)
            End If
            Return Me.mUIItemWindow
        End Get
    End Property

    Public ReadOnly Property UICancelWindow() As UICancelWindow
        Get
            If (Me.mUICancelWindow Is Nothing) Then
                Me.mUICancelWindow = New UICancelWindow(Me)
            End If
            Return Me.mUICancelWindow
        End Get
    End Property
    #End Region

    #Region "Fields"
    Private mUIValidationTitleBar As WinTitleBar

    Private mUITxtMessageWindow As UITxtMessageWindow

    Private mUIItemWindow As UIItemWindow

    Private mUICancelWindow As UICancelWindow
    #End Region
End Class`
Roemer commented 6 years ago

See attached issue from FlaUI, would be similar in White but staying with FlaUI is a wise choice ;)