Ask a Question

How to verify word wrapping in a panel which consists of blocks containing text?

Moulya_p
Occasional Contributor

How to verify word wrapping in a panel which consists of blocks containing text?

Hello Everyone,

 

I have an object which has the ObjectType as Panel. It consists a number of card-blocks with text and the ObjectType is Panel for each of them. I need to verify if the card-blocks containing text are getting wordwrapped.

 

For this, I first detected the card-blocks containing the text and made use of the WordWrap method. But it is throwing me an error.  

 

Could someone please let me know where am I going wrong and suggest how to resolve this issue?

7 REPLIES 7
baxatob
Community Hero

Re: How to verify word wrapping in a panel which consists of blocks containing text?

Hi,

 

Can you provide your text sample and the code you are using?

Moulya_p
Occasional Contributor

Re: How to verify word wrapping in a panel which consists of blocks containing text?

The text is just a string with more than 50 characters. I am passing this string to the textbox using the Keys method. After adding this text, I am checking in the panel where it is displayed, whether the text is word wrapped ot not.

 

var str = "Any string which is more than 50 characters"

var textArea = obj.FindChild(["ObjectType", "className"], ["Textarea", "noteText"], 5);

textArea.Keys(str);

//Click on Add button to add the text

var textPanel = obj.FindChild("ObjectType", "className"], ["Panel", "card-text"], 5);

var bool = textPanel.WordWrap;

 

I am very new to TestComplete, so I don't know if my approach is right or not. I would really appreciate if you could provide me your inputs.

 

tristaanogre
Community Hero

Re: How to verify word wrapping in a panel which consists of blocks containing text?

What is the error message you're getting?

 

 


Robert Martin
[Hall of Fame]
Please consider giving a Kudo if I write good stuff
----

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Vegas Thrill Rider
Extensions available
baxatob
Community Hero

Re: How to verify word wrapping in a panel which consists of blocks containing text?

According to documentation the WordWrap property just specifies whether the multi-line component wraps its text to fit the component’s width. 

 

In your case you need to check that your input element has a MaxLength property == 50. That's enough as I think.

However you can addittionally obtain the result after the text was inputed and check it's length.

Moulya_p
Occasional Contributor

Re: How to verify word wrapping in a panel which consists of blocks containing text?

 tristaanogre

 

I am getting the error saying "Unable to find the object WordWrap".

Moulya_p
Occasional Contributor

Re: How to verify word wrapping in a panel which consists of blocks containing text?

 

I need to verify if the string which is given as an input is wrapping its text to fit the component's width. Here, I would be mainly checking the word wrapping feature. The text wraps when there are more number of characters, that is the reason I mentioned length as 50 earlier.

baxatob
Community Hero

Re: How to verify word wrapping in a panel which consists of blocks containing text?

Did you explore properties of your textPanel? Using Object Spy or Object Browser.

Does it have WordWrap property at all? Here you can find how to do it >>

 

cancel
Showing results for 
Search instead for 
Did you mean: