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

3 posts, 0 answers
  1. Mamata
    Mamata avatar
    7 posts
    Member since:
    Jul 2011

    Posted 02 Jul 2013 Link to this post

    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. Mario
    Admin
    Mario avatar
    8 posts

    Posted 03 Jul 2013 Link to this post

    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!
  3. Mamata
    Mamata avatar
    7 posts
    Member since:
    Jul 2011

    Posted 05 Jul 2013 Link to this post

    Thank you very much. I appreciate your help on this!
Back to Top