Click here to Skip to main content
15,887,477 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
C#


When i am running a coded ui project, we were expected one pop up window out of 4 different pop up's. We do not know which window will appear in runtime.
If i use if conditions, code is waiting for all the windows exists or not within some specific time it has.


So, If i can recognize the window name in run time using coded ui, by using switch case code will run accordingly.

Please help me if it is possible.

Thank you for your time in advance.

What I have tried:

I tried in several sites they are showing how to recognize control. :(
Posted
Updated 12-Feb-18 5:56am
Comments
OriginalGriff 12-Feb-18 10:05am    
Who is opening the window? Is it your app, or a different app?
niranjan3717 13-Feb-18 4:40am    
My Application was opening the window

I am running Coded UI from WPF application
Ziee-M 12-Feb-18 11:22am    
Also are you using WPF or Winforms ?
Show us some code we will gladly help
niranjan3717 13-Feb-18 5:04am    
BrowserWindow TWwindow = BrowserWindow.Launch("https://nasy00twappt1.com/");
Playback.Wait(2000);

Tw.UILoginToTrackWiseInteWindow.UILoginToTrackWiseDocument.UITfUserNameEdit.Text = "Username";
Tw.UILoginToTrackWiseInteWindow.UILoginToTrackWiseDocument.UITfPasswordEdit.Text = "Password";
Mouse.Click(Tw.UILoginToTrackWiseInteWindow.UILoginToTrackWiseDocument.UILogInButton.UILogInPane);
TrackWiseFields.LoginFailed = false;
Playback.Wait(1000);
HtmlSpan DCHUName = intake.UIDesktopUserDCHUWindow.UIMain_framesetCustom.UILoginFrame.UIHttpsnasy00twappt1bdDocument.UITopBarFocusTable.DCHUUsernamePane;

if (Tw.UIInvalidLDAPwebpageWindow.UIInvalidLDAPloginorpaWindow.UIInvalidLDAPloginorpaText.TryFind() == true || Tw.UIInvalidUserNameandPasswordwebpageWindow.UIInvalidusernameorpasWindow.UIInvalidusernameorpasText.TryFind() == true)
{
Mouse.Click(Tw.UIInvalidUserNameandPasswordwebpageWindow.UIInvalidUserNameandPasswordOKWindow.UIInvalidUserNameandPasswordOKButton);

}
else
{
MessageBox.show("Login sucess");
}

1 solution

 
Share this answer
 
Comments
BillWoodruff 13-Feb-18 1:29am    
+5

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900