Forum Discussion

rshahwan's avatar
rshahwan
Occasional Contributor
13 years ago

Access button of WPF Message Box (DevExpress.Xpf.Core.DXMessageBox)

HI



I'm testing a desktop application that uses DevExpress WPF 3rd party controls. i'm having a difficulty to let TestComplete click "Yes" button on the confirmation message.



My test Case is



1. Click Delete button

2. Click Yes on confirmation message



Test complete was able to find the Message Box itself and it was able to find the text inside the message box.... but how i want to make test compelte click on the "Yes" or "No" button.



here is my code

    var popup = getPopupWindow(app);

    if (popup !=null)

{



    popup.DoButtonClick(popup.messageBoxButtons);

}



Test complete failed to do the button click



i appreciate any help i can get....



Thanks



Rami

4 Replies

  • rshahwan's avatar
    rshahwan
    Occasional Contributor

    I tried the second option which is the OCR. The picture of the popup window is captured but the method to GetText is caused textcomplete to crash. the error is in PMP2TextServer.dll.



    Here is my code





    var popup = getPopupWindow(app);


    if (popup !=null)


    {


    TextToFind = "Yes";


     


    Pic = popup.Picture(0, 0, popup.Width, popup.Height, false);


    Log.Picture(Pic, "Popup Wnd."); -- this is ok, i get the screenshot for the popup window


     


    OCRObjList = OCR.CreateObject(Pic); -- this Ok, no exception is occured


    OCROptionsList = OCRObjList.CreateOptions(); -- Ok


    FontItem = OCROptionsList.Fonts.Add(); -- Ok


    FontItem.Name = "Tahoma"; -- Ok


    FontItem.Sizes.Add(12); -- OK


     


    Log.Message("Added OCR Options"); -- Ok


     


    OCRObjList.GetText(); --- EXCEPTION - BMP2TextServer.dll... Textcomplete is crashed


     


    FindRes = OCRObjList.FindRectByText(TextToFind, OCROptionsList); --- EXCEPTION - BMP2TextServer.dll... Textcomplete is crashed 

    Log.Message("FindRes");


     if (FindRes)


    {


    Log.Message("The coordinates of the center of the found area. FoundX = " +


    aqConvert.IntToStr(OCRObjList.FoundX) + "; FoundY = " + aqConvert.IntToStr(OCRObjList.FoundY) + ".");


    popup.Click(OCRObjList.FoundX, OCRObjList.FoundY);



     

  • rshahwan's avatar
    rshahwan
    Occasional Contributor
    I have not heared from you regarding this issue... any updates on how to make test complete click on the "Yes" button of popup window....



    I appreciate the help as i'm trying to evaluate TestComplete



    Thanks



    Rami
  • aqAnt's avatar
    aqAnt
    SmartBear Alumni (Retired)

    Hello Rami,


    We have received your support requests, so we will continue working with you via e-mail.