I have one script which adds a customer and adds another customer with same name and the error is thrown "Customer is already existing"here i am trying to grab this message and try to validate if this message exists my testcase is passed else it is failed,but it is printing else loop message,i even used web_obj_get_text,compare,..can anyone suggest me with any another way
if(text=="First Name is required")
Here though the text printed was "First Name is required",it is printing else message as Failed.
Are you sure there are no spaces or extra characters in the "text" varible? Is it possible that it could be " First Name is required ", " First Name is required", "First Name is required " or some variation of that?
In your print statement I would do something like this:
This will ensure there is no blank or unprinatble characters in your string.
And instead of doing a simple compare you may want to try this function, since you are dealing with strings: compare_text ( str1, str2 [, chars1, chars2 ] );