Width of an table

9 posts, 0 answers
  1. Michael
    Michael avatar
    21 posts
    Member since:
    Apr 2013

    Posted 16 May 2013 Link to this post

    Hoe do i get the width of an dynamic created table?

    In Coded Step i do find the element with
                HtmlTable resultTable = Find.ByExpression<HtmlTable>("name=aspnetForm","|","TagName=table","id=~cmsWebControlContainer");

    But resultTable.width returns nothing. 
    resultTable.GetComputedStyle("width").Value return "auto"?

    So, how can i get the real width?
  2. Boyan Boev
    Admin
    Boyan Boev avatar
    1040 posts

    Posted 17 May 2013 Link to this post

    Hi Michael,

    If the width is set to "auto" then this is expected behavior in Internet Explorer. Even if it is not set to "auto", the default value in Internet Explorer is "auto".

    To get the actual width you should use table's rectangle. It has width property which returns the actual number instead of "auto":

    using System.Drawing;

    HtmlTable resultTable = Find.ByExpression<HtmlTable>(
    "name=aspnetForm","|","TagName=table","id=~cmsWebControlContainer");
     
    System.Drawing.Rectangle rect= resultTable.GetRectangle();
    Log.WriteLine(rect.Width.ToString() + "px");

    Note that you should add System.Drawing reference assembly.

    Let me know if this helps. 

    Greetings,
    Boyan Boev
    the Telerik team
    Quickly become an expert in Test Studio, check out our new training sessions!
    Test Studio Trainings
  3. Michael
    Michael avatar
    21 posts
    Member since:
    Apr 2013

    Posted 17 May 2013 Link to this post

    Thanks, that works .
  4. Boyan Boev
    Admin
    Boyan Boev avatar
    1040 posts

    Posted 17 May 2013 Link to this post

    Hi Michael,

    I am glad I could help.
     
    Please don't hesitate if you have additional questions.  


    Greetings,

    Boyan Boev
    the Telerik team
    Quickly become an expert in Test Studio, check out our new training sessions!
    Test Studio Trainings
  5. John
    John avatar
    8 posts
    Member since:
    Jul 2012

    Posted 06 Dec 2014 in reply to Boyan Boev Link to this post

    Hi, I read this post as I'm getting wired with coffee (Warning I'm wired, proceed with extreme caution!), a question came to mind.  During recording can we do the following, and how:
    1) High light the area during play back.
    2) Take an image of the area and save it as a file?
    3) Have it make more coffee (just kidding!)

    thanks,
    John
  6. John
    John avatar
    8 posts
    Member since:
    Jul 2012

    Posted 06 Dec 2014 in reply to Boyan Boev Link to this post

    Hi, I read the post and came up with a few questions, and how we can do them.:
    1) Can we have the highlight come up of the object during playback?
    2) Can we take an image of the object in the rectangle.

    just a few thoughts,
    thanks,
    John
  7. Boyan Boev
    Admin
    Boyan Boev avatar
    1040 posts

    Posted 10 Dec 2014 Link to this post

    Hi John,

    During the playback Test Studio can highlight the elements which it interacts with. Please turn on the annotations to achieve this. See this article for more information.

    Regarding the second question please see this KB.

    Hope this helps.

    Regards,
    Boyan Boev
    Telerik
     
    The New Release of Telerik Test Studio Is Here! Download, install,
    and send us your feedback!
  8. John
    John avatar
    8 posts
    Member since:
    Jul 2012

    Posted 10 Dec 2014 in reply to Boyan Boev Link to this post

    Thank you for your reply, however; your showing me the on/off switch to highlight all objects under gods green earth.  What I'm asking is the same functionality as in Microsoft coded UI the DrawHighlight method, where we can of the object found highlighted.  Below are example's of this being done in MS Coded UI, and I was asking how this can be done in Telerik? 

    Thanks,
    John

    Marcel de Vries / Pluralsight Course
    http://www.pluralsight.com/courses/transcript/codedui-test-automation / Visual Debug Playback

    Coded UI highlight controls DrawHighlight
    https://social.msdn.microsoft.com/Forums/en-US/122affb3-16e7-4270-97e9-a3016de887bd/coded-ui-highlight-controls-drawhighlight?forum=vstest
  9. Boyan Boev
    Admin
    Boyan Boev avatar
    1040 posts

    Posted 15 Dec 2014 Link to this post

    Hello John,

    You can use our Visual Debugger which is very helpful tool for troubleshooting. Please see this article

    You can also highlight a particular element via "Edit in Live" function.

    Hope this helps.

    Regards,
    Boyan Boev
    Telerik
     
    The New Release of Telerik Test Studio Is Here! Download, install,
    and send us your feedback!
Back to Top