This is a migrated thread and some comments may be shown as answers.
Dialog woes
1 Answer 41 Views
This is a migrated thread and some comments may be shown as answers.
Felix
Top achievements
Rank 1
Felix asked on 17 May 2012, 12:21 AM
hi,

I have a script where 2 dialogs are presented. The first gets clicked as expected but the 2nd highlights the OK button but the click never happens. I've tried to start a 2nd dialog monitor to try and solve, but still no success.

It sits @ browser.Actions.Click(browser.Find.ByAttributes("href=~deleteMember.hg?memberId=")); and doesn't do anything.

Any help is appreciated.


public void QSCDeleteMember()
       {
           foreach (Browser browser in _testBrowsers)
           {
               //Login
               _setup.Login(browser);
 
               //Go to Search Members page
               Menu.GoToMenuOption(browser, MenuOptions.SearchMembers);
 
               //Select a member to delete
               MemberTesting memberTesting = new MemberTesting();
               HtmlTableRow memberRow = memberTesting.SelectMember(browser);
 
               //Get selected member's email address, 4th cell of memberRow
               HtmlAnchor email = memberRow.Cells[3].ChildNodes[0].As<HtmlAnchor>();
               Member deleteMember = new Member();
               deleteMember.Address.EmailAddress = email.InnerText;
 
               //Click 'Edit' button to enter member information page
               browser.Actions.Click(memberRow.Find.ByAttributes("href=~editMember.hg?memberId="));
 
 
               //Select a contact to delete
               HtmlTableCell td = browser.Find.ByAttributes<HtmlTableCell>("class=~selection-row1", "align=left");
               //Start Popup monitor to verify delete of contacts and members
               AlertDialog alertDialog = AlertDialog.CreateAlertDialog(browser, DialogButton.OK);
 
               if (td != null)
               {
                   HtmlTableRow contactRow = td.Parent<HtmlTableRow>();
                   string contactName = td.Find.ByAttributes<HtmlAnchor>("href=~editMemberContact.hg?memberId=").TextContent;
 
                   //Start Popup monitor to verify delete of contacts and members
                    
                   browser.Manager.DialogMonitor.AddDialog(alertDialog);
                   browser.Manager.DialogMonitor.Start();
                   //Delete member contact/address information
                   browser.Actions.Click(contactRow.Find.ByAttributes("href=~deleteMemberContact.hg?memberId="));
                   Assert.IsTrue(memberTesting.VerifyContactDeleted(browser, contactName), "Contact was not deleted");
               }
 
                
                
               //browser.Manager.DialogMonitor.AddDialog(alertDialog);
               //browser.Manager.DialogMonitor.Start();
 
                
 
               browser.Manager.DialogMonitor.Stop();
               browser.WaitUntilReady();
               browser.RefreshDomTree();
 
               AlertDialog alertDialog2 = AlertDialog.CreateAlertDialog(browser, DialogButton.OK);
               browser.Manager.DialogMonitor.AddDialog(alertDialog2);
               browser.Manager.DialogMonitor.Start();
 
               //Delete member, verify they were deleted
               browser.Actions.Click(browser.Find.ByAttributes("href=~deleteMember.hg?memberId="));
               Assert.IsFalse(memberTesting.MemberExists(browser, deleteMember), "Member was not deleted");
 
               //Stop popup monitor, logout
               browser.Manager.DialogMonitor.Stop();
               _setup.Logout(browser);

1 Answer, 1 is accepted

Sort by
0
Accepted
Plamen
Telerik team
answered on 17 May 2012, 04:37 PM
Hello Felix,

We currently have a known issue with our DilogMonitor. When there are multiple dialogs that needs to be handled, the DialogMonitor sometimes fails to start properly. We already have a fix for this implemented. It will be included in our next SP release, scheduled to go live at the end of this month. 

In the meantime, you can workaround the issue by modifying your code like this:
if (td != null)
{
    HtmlTableRow contactRow = td.Parent<HtmlTableRow>();
    string contactName = td.Find.ByAttributes<HtmlAnchor>("href=~editMemberContact.hg?memberId=").TextContent;
 
    //Start Popup monitor to verify delete of contacts and members
    AlertDialog alertDialog = AlertDialog.CreateAlertDialog(browser, DialogButton.OK);
    browser.Manager.DialogMonitor.AddDialog(alertDialog);
    browser.Manager.DialogMonitor.Start();
 
    //Delete member contact/address information
    browser.Actions.Click(contactRow.Find.ByAttributes("href=~deleteMemberContact.hg?memberId="));
 
    alertDialog.WaitUntilHandled();
    browser.Manager.DialogMonitor.RemoveDialog(alertDialog);
 
    Assert.IsTrue(memberTesting.VerifyContactDeleted(browser, contactName), "Contact was not deleted");
}
browser.WaitUntilReady();
browser.RefreshDomTree();
 
 
AlertDialog alertDialog2 = AlertDialog.CreateAlertDialog(browser, DialogButton.OK);
browser.Manager.DialogMonitor.AddDialog(alertDialog2);
browser.Manager.DialogMonitor.Start();
 
//Delete member, verify they were deleted
browser.Actions.Click(browser.Find.ByAttributes("href=~deleteMember.hg?memberId="));
 
alertDialog2.WaitUntilHandled();
browser.Manager.DialogMonitor.RemoveDialog(alertDialog2);
 
Assert.IsFalse(memberTesting.MemberExists(browser, deleteMember), "Member was not deleted");
Hope this helps!   

Regards,
Plamen
the Telerik team
Quickly become an expert in Test Studio, check out our new training sessions!
Test Studio Trainings
Asked by
Felix
Top achievements
Rank 1
Answers by
Plamen
Telerik team
Share this question
or