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

How to verify if height of an svg element is greater than 0

2 Answers 110 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Mamata
Top achievements
Rank 1
Mamata asked on 02 Jul 2013, 04:16 PM
I have a verification step in the attached image where basically it verifies if attribute has a height of 136.31.  I need to tweak it so that this verification makes sure if element has a height >0 ? Is it possible to do this? It would be great if you could show me with some coded scripting or any other example.

Thanks,
Mamata

2 Answers, 1 is accepted

Sort by
0
Mario
Telerik team
answered on 03 Jul 2013, 10:00 PM
Hello Mamata,

Thank you for contacting Telerik Support.

The first step in making this kind of verification will be to extract the current value of this attribute into variable using an extract step. You can very easily convert the type of any existing verification's between a verify, wait or extract via the step context menu (right-click step -> Change Role -> Set as). Once we have the value stored in an extracted variable, we need to reference it in code in order to be able to manipulate it (see extracted variables in code). Having done so allows us to convert the object into a double and make our assertion. See full example below:

object height = GetExtractedValue("ExtractedVariableName");
double svheight = Convert.ToDouble(height);
Assert.IsTrue(svheight > 0);

Please let me know whether you have any additional questions.

Regards,
Mario
Telerik
Free summer webinars on advanced web automation tactics hosted by Jim Holmes & Adam Goucher.
Reserve your seat today!
0
Mamata
Top achievements
Rank 1
answered on 06 Jul 2013, 03:29 AM
Thank you very much. I appreciate your help on this!
Tags
General Discussions
Asked by
Mamata
Top achievements
Rank 1
Answers by
Mario
Telerik team
Mamata
Top achievements
Rank 1
Share this question
or