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

GetComputedStyleValue() does not work in FireFox

1 Answer 71 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Toldo
Top achievements
Rank 1
Toldo asked on 29 Aug 2012, 12:23 PM
Hello,

When I am using next code to get computed CSS style value it works in every browser except FireFox (v.14.0.1 and v.15.0):
string style = new HtmlControl(element).GetComputedStyleValue("font-family");
I have managed to proceed with workaround in JS, but it looks like something wrong with plugin in latest FF browser versions.

string script = @"function getstyle() {var el = document.getElementById('" + element.IdAttributeValue + "');" +
"var computedStyles = window.getComputedStyle(el, null);\n" +
"return computedStyles.getPropertyValue('font-family')}\n getstyle()";
style = Actions.InvokeScript<string>(script);

The exception thrown listed below:

ArtOfTest.WebAii.Exceptions.ExecuteCommandException was unhandled by user code
  Message=ExecuteCommand failed!
InError set by the client. Client Error:
mozCommandProcessor: ReferenceError: family is not defined
BrowserCommand (Type:'Information',Info:'ComputedStyle',Action:'NotSet',Target:'ElementId (tagName: 'div',occurrenceIndex: '11')',Data:'font-family',ClientId:'226bfc0e-c75f-4d6d-8837-eed994cd46c2',HasFrames:'False',FramesInfo:'',TargetFrameIndex:'-1',InError:'True',Response:'mozCommandProcessor: ReferenceError: family is not defined')
InnerException: none.


1 Answer, 1 is accepted

Sort by
0
Plamen
Telerik team
answered on 03 Sep 2012, 10:32 AM
Hello Toldo,

Thank you for reporting the issue. I was able to reproduce it and logged it as a bug. You can track its progress in our PITS system here: Public URL.

I've updated your Telerik Points accordingly.   

Regards,
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
Toldo
Top achievements
Rank 1
Answers by
Plamen
Telerik team
Share this question
or