TestStack / White

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

Panel Click #627

Open gergo0 opened 5 years ago

gergo0 commented 5 years ago

I want to create an autologin WinForms app with TestStack.White. Here is my code:

private void button1_Click(object sender, EventArgs e)

{
         Process[] process = Process.GetProcessesByName("XYapp");
         TestStack.White.Application app = TestStack.White.Application.Attach(process[0].Id);
         TestStack.White.UIItems.WindowItems.Window window = app.GetWindow("XYwindowName", TestStack.White.Factory.InitializeOption.NoCache); 
         TestStack.White.UIItems.Panel panel = window.Get<TestStack.White.UIItems.Panel>(TestStack.White.UIItems.Finders.SearchCriteria.ByText("Login"));
         panel.Click();
         ...
}

The XY app main window has 10+ panels and one of them is the "Login" panel. When I click the button1, the XY app "Login" panel will be visible, so it works.

But my WinForms app freezes and I get the control back when I close the XY program but I want to run further.

In debug mode, the following error message is displayed: "Managed Debugging Assistant 'DisconnectedContext' : 'Transition into COM context 0x15305d0 for this RuntimeCallableWrapper failed..."

I think I understand why I get this message, but I have no idea what the solution is.

Someone could help me? thanks