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

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

1 Answer 53 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Andrei
Top achievements
Rank 1
Andrei asked on 20 Aug 2012, 05:37 PM
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:
Remarks:
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)

1 Answer, 1 is accepted

Sort by
0
Accepted
Plamen
Telerik team
answered on 24 Aug 2012, 08:35 AM
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,
Plamen
the Telerik team
Quickly become an expert in Test Studio, check out our new training sessions!
Test Studio Trainings
Tags
General Discussions
Asked by
Andrei
Top achievements
Rank 1
Answers by
Plamen
Telerik team
Share this question
or