try
{
BrowserWindow browserWindow = new BrowserWindow();
browserWindow.PerformDialogAction(BrowserDialogAction.Ok);
}
catch (Exception)
{
// If a popup does not exists and an error is thrown, continue...
Playback.PlaybackSettings.ContinueOnError = true;
}
=======================
//Launch browser BrowserWindow browser = BrowserWindow.Launch("C:\\Users\\v-zuqu......"); //Create Control for Hyperlink that u want to click.. UITestControl control = new UITestControl(browser); control.TechnologyName = "Web";//u can see technology name in search properties window by spying on Hypelink using CodedUITest Builder control.SearchProperties.Add("Id","xxxx","ControlType","Hyperlink"....);//u can see the search properties by spying on the control //Wait for the above control after launching the browser control.WaitForControlReady(); //Now, click on that Control Mouse.Click(control); //you u will get IE pop-up..so..create IE pop-up control UITestControl popup = new UITestControl(null); popup.TechnologyName = "MSAA"; popup.SearchProperties.Add("Name","xxxxx","ClassName","xxxxx"......);//u can add more search properties by looking at Search properties window. //u need to click on yes button..so, create control for that..as... UITestControl yesBtn = new UITestControl(popup); yesBtn.TechnologyName = "MSAA"; yesBtn.SearchProperties.Add("Class","xxxx","Name","xxxx"....);//add search properties by looking at Search properties window //Click on yes button, if ur unable to click on yes button first write "popup.SetFocus();" and then click on yes button Mouse.Click(yesBtn); //Now close thebrowser using the following code. browser.Close();
No comments:
Post a Comment