Forum Discussion

Urmikhan's avatar
Urmikhan
Occasional Contributor
5 years ago
Solved

Verify SuccessfulMessage

I have to verify this Message "'Saved and published successfully!'"in my page .if not show error Message.I inclueded my code but not working.Please help me to this code:

function objCheckSMessage() {
fMessage = "Test Failed";
var successfulMessage = objPages().FindChild(['Name', 'idStr'],['TextNode("validationSuccessMsg")', "validationSuccessMsg"], 20);
var sMessage = successfulMessage.contentText;
if (sMessage == 'Saved and published successfully!' ) {
Log.Message("Addcustomer:" + sMessage); 
} else {
Log.Message("Error Message: " +fMessage );

}

}

  • Would you mind posting a screenshot of your object tree.  What error message does TC give you ?

     

    Your 'Name' Property of 'TextNode("ValidationSuccessMsg")' doesn't look right.

     

    Perhaps you are looking at something like 

    var props = ['ObjectType','ObjectIdentifier'];
    var vals = ['TextNode','validationSuccessMsg'];
    containerObj.FindChild(props,vals,20);
    
    

    What is objPages() ?  It is possible that it's not something valid for performing a Find on

6 Replies

  • Would you mind posting a screenshot of your object tree.  What error message does TC give you ?

     

    Your 'Name' Property of 'TextNode("ValidationSuccessMsg")' doesn't look right.

     

    Perhaps you are looking at something like 

    var props = ['ObjectType','ObjectIdentifier'];
    var vals = ['TextNode','validationSuccessMsg'];
    containerObj.FindChild(props,vals,20);
    
    

    What is objPages() ?  It is possible that it's not something valid for performing a Find on

    • Urmikhan's avatar
      Urmikhan
      Occasional Contributor

      objPages() is intialize browser and page.as requested I attached screenshot my object tree.

      • Urmikhan's avatar
        Urmikhan
        Occasional Contributor

        Tc doest not shows proper messages.