0

If I look at page source I see

<script language="javascript" type="text/javascript">
                styling += 'ul#topnav a.tabHeader5';
                styling += '{';
                styling += 'width: 142px;'; 
</script>

If I get html source from this page by selenium I see

<style type=\"text/css\">\n\t\t\t\tul#topnav a.tabHeader5\n\t\t\t\t{\n\t\t\t\t\twidth: 142px;</style>

I don't understand why it is changed from javascript to css.

Matt Ball
  • 354,903
  • 100
  • 647
  • 710
ktarik
  • 653
  • 1
  • 6
  • 9

2 Answers2

3

I don't understand why it is changed from javascript to css.

The JavaScript, when executed, alters the CSS.

Matt Ball
  • 354,903
  • 100
  • 647
  • 710
  • and why I don't see it when I look at page source in browser? – ktarik Apr 13 '12 at 15:25
  • Because the browser's "View Source" shows the HTML as the server sends it, not the current state of the HTML. If you want to see what the HTML currently looks like, use the browser's developer tools. – Matt Ball Apr 13 '12 at 15:28
0

It looks like there is some javaScript logic, either in the same page or in a different file referred by this page which dynamically writes the CSS styles based on the values in the "styling" variable declared in the script.

Scorpion-Prince
  • 3,574
  • 3
  • 18
  • 24