This is a migrated thread and some comments may be shown as answers.

Can not verify encode text

3 Answers 49 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Ha
Top achievements
Rank 1
Ha asked on 24 May 2012, 09:05 AM
Hi all
After I recorded verify step on IE
I run it on firefox but it's not running because encode of string
I corrected :  Pages.InachisHardwareAndChannels0.StartNbspMarkLabelTag.AssertContent().TextContent(ArtOfTest.Common.StringCompareType.Contains, WebUtility.HtmlDecode("Start Mark"));
But it don't run.

Please refer attachment
Thanks so much

3 Answers, 1 is accepted

Sort by
0
Stoich
Telerik team
answered on 28 May 2012, 01:14 PM
Hello,
you need to be careful with &nbps. IE renders it as blank space. Firefox does not render that element - instead its treated as regular text within the HTML code of the page. You need to work around this limitation:

This can be a problem on two separate occasions:
1) Find Expressions. If the find logic for an element is based on its text content. For instance:
Text Content is exactly &nbpssometext
you need to change that to
Text Content contains sometext
http://www.telerik.com/automated-testing-tools/support/documentation/user-guide/elements-pane-overview/find-element.aspx

2) Text Content Verifications:
Verify Text Content is exactly &nbpssometext
needs to be changed to
Verify Text Content contains &sometext

Greetings,
Stoich
the Telerik team
Quickly become an expert in Test Studio, check out our new training sessions!
Test Studio Trainings
0
Ha
Top achievements
Rank 1
answered on 29 May 2012, 02:41 AM
Hi Stoich
If Text Content Verifications:
Verify Text Content is exactly &nbpssometext
needs to be changed to
Verify Text Content contains &sometext
1- I must change test when I test on other brower. It's right?
2- Otherwise, I know "contains compare type" is not exactly .
For example: compare string (1) "HHa" and  string (2) "Ha"  with "Ha"
If use exact ="Ha", only string (2) is correct
But use contain ="Ha", both of them is correct
Is it right?
0
Stoich
Telerik team
answered on 31 May 2012, 05:41 PM
Hi,
If Text Content Verifications:
Verify Text Content is exactly &nbpssometext
needs to be changed to
Verify Text Content contains &sometext

It needs to be changed to Verify Text Content contains sometext (without the '&').

1- I must change test when I test on other brower. It's right? - No, the Contains will work on both browsers.

2- Otherwise, I know "contains compare type" is not exactly .
For example: compare string (1) "HHa" and  string (2) "Ha"  with "Ha"
If use exact ="Ha", only string (2) is correct
But use contain ="Ha", both of them is correct
Is it right?

Yes, this is correct!

If you're worried that Contains is not specific enough for you - you can create two separate steps and configure each to run again a specific browser:
http://www.telerik.com/automated-testing-tools/support/documentation/user-guide/code-samples/general/browser-specific-actions.aspx

Regards,
Stoich
the Telerik team
Quickly become an expert in Test Studio, check out our new training sessions!
Test Studio Trainings
Tags
General Discussions
Asked by
Ha
Top achievements
Rank 1
Answers by
Stoich
Telerik team
Ha
Top achievements
Rank 1
Share this question
or