OuterMarkup returns different value from different Internet Explorer versions

4 posts, 0 answers
  1. Andrei
    Andrei avatar
    8 posts
    Member since:
    Sep 2010

    Posted 28 May 2014 Link to this post

    Hi,

    the following code returns different results when running on IE11 and IE9:

    String test = Find.ByXPath("//tr/td[contains(text(), 'Education')]").As<HtmlControl>().BaseElement.OuterMarkup;
    Manager.Log.WriteLine("OuterMarkup is: " + test);

    IE11 (and FireFox):
    [Trace] : OuterMarkup is: <td scope="row">Education</td>

    IE9:
    [Trace] : OuterMarkup is: <TD scope=row>Education</TD>

    So assert on OuterMarkup fails when running on different machines.
    Page itself has "<td scope="row">Education</td>" value - test is a modified one from the test suite that comes together with the framework.

    You can download this sample project here.
    Latest framework version is used (2014.1.410.0).

    Can you please comment on this issue ?
  2. Ivaylo
    Admin
    Ivaylo avatar
    750 posts

    Posted 02 Jun 2014 Link to this post

    Hello Andrei,

    Please excuse me for the delayed reply.
    Just for your information the archive you provided is broken, so I am not able to extract it. However I might not need to since the issue you are describing seems to be browser specific and not depending on Test Studio at all. What is returned as an Outer Markup should be exactly what the browser renders. Out of Test Studio just check how the different browsers display the Outer Markup.


    Thank you for your understanding.

    Regards,
    Ivaylo
    Telerik
     
    Quickly become an expert in Test Studio, check out our new training sessions!
    Test Studio Trainings
     
  3. Andrei
    Andrei avatar
    8 posts
    Member since:
    Sep 2010

    Posted 02 Jun 2014 in reply to Ivaylo Link to this post

    Hello Ivaylo,

    you can try to download the project from different link.

    Attached you can find screenshots of what IE browser shows when inspecting this element - and both IE9/IE11 show the same code.

    Is what browser renders different from what it shows in page code section?

    Thank you,
    Andrei
  4. Ivaylo
    Admin
    Ivaylo avatar
    750 posts

    Posted 03 Jun 2014 Link to this post

    Hello Andrei,

    I have investigated this a bit further. It is indeed related to a different browser behavior. TestStudio’s OuterMarkup call internally asks the browser for the markup using the innerHTML and outerHTML property of the element.
    As you can see from the screenshot attached, the markup returned from the browser call changes between IE9 and IE11; note the quotation marks around the scope=row value and the fact that the tag TD is now in uppercase like in your case.

    The reason for this change in IE’s behavior is described in this MSDN Blog post. Basically, in IE10 or later, the “quirks” mode starts behaving more like the quirks mode of browsers like Firefox.

    In order to work interoperably with IE9,  you should either have to update the markup (so that it’s not running in Quirks mode, or is forced to legacy Quirks Mode) or change their logic in the assertion to handle the different results across browsers.


    Thank you for your understanding.

    Regards,
    Ivaylo
    Telerik
     
    Quickly become an expert in Test Studio, check out our new training sessions!
    Test Studio Trainings
     
Back to Top