Could you please post a snapshot of the message box? If the Spy highlights all elements, then your path is not unique enough to select only the element you need to validate.
BTW, do you really need to use the code to validate the value in message box? If you are using Recordings, then you can either add a validation step manually or using Record (Record From Here) feature. Using "Record From Here" is probably easier, because Record will automatically add required element to the repository (or select it, if the element is already in repository).
OK, here is how you can validate the text using Record From Here.
- - At first, make sure the message box in question is already open.
- Then go to your Recording, right click the last step after which you would like to validate the text and from the context menu select "Record From Here".
- In the appeared dialog click "Validate" button.
- Select the text in message box you would like to validate.
- And finally, follow the steps in Validation dialog, where you should select what should be validated.
- After finishing the above steps, terminate recording.
That's all. Now you should have a new validation step in your recording. Hope this helps?