GetValue returns different results when using different browsers and non-existing attribute

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

    Posted 20 Aug 2012 Link to this post

    Hi all,

    the following piece of code returns different result on IE9 and FireFox14 browsers when attribute does not exist for specified element:
    HtmlControl control = Get(xpath, browser, errorMessage).As<HtmlControl>();
    string returnValue = control.GetValue<string>(attribute.ToString().ToLower());
    return returnValue;

    on IE9  returnValue is equal to '' (empty string)
    and on FireFox it is equal to 'null' (this is not NULL reference, this is a string 'null')

    This function has the following remark:
    The property is retrieved by executing Javascript on the client side using the specified property name as the Javascript function.
    so I suppose it "forwards" the result from browser that executes Javascript.

    However, I expect methods to be browser-independent -> return the same result irrespectively of browser that is used.

    Can you please comment whether:
    1. I'm doing something wrong
    2. this should be treated as a defect that will be fixed some day
    3. this should be treated as a defect that will be never fixed
    4. this is a feature (please explain why)
  2. Answer
    Plamen avatar
    8 posts

    Posted 24 Aug 2012 Link to this post

    Hi Andrei,

    I am sorry to hear you are running into this problem. Unfortunately, the returned value is not "browser-independent". Test Studio simply takes the result from the JavaScript function and this result can be different in different browsers. We also have a section that gives some examples of Browser InconsistenciesThis article describes a similar problem with an HTML Button.

    If you are experiencing any difficulties with this behavior, please provide a sample site, a code block, and a deeper explanation of what you're trying to test and we'll try to find a workable solution for you.

    All the best,
    the Telerik team
    Quickly become an expert in Test Studio, check out our new training sessions!
    Test Studio Trainings
Back to Top