Page or Object size with Watir Webdriver
Asked Answered
Z

1

7

Is there any way to get the page size (in bytes) from the browser with Watir Webdriver? I need to record it for every page (I'm interested into the overall sum, not into detail of each object), so saving to a file and get the file size is not a suitable way.

I can use different browsers, but prefer Firefox,

Zeniazenith answered 20/6, 2013 at 10:25 Comment(4)
+1 very good question. I am waiting for the answer to come. :)Supportive
One way of doing would be getting the source of the page like: src = b.html and then src.bytesize, but it's not the actual size though, it's just the string length. Couldn't have accomplish .. Waiting for guru's answers :)Peek
Upvote. Just the byte size of the HTML? Including image sizes too?Firebrand
My need is about getting all the data moved by that page, but, you know, a partial solution is better than no solution at all... Honestly, I expected a simple and direct call/property, as these infos are already available at browser level (see Tools -> Page information on Firefox).Zeniazenith
H
0

This "http://watirwebdriver.com/page-performance/" works only in chrome, but the grouping memory seems to have what you want,

Install and require 'watir-webdriver-performance'

Halliday answered 26/6, 2013 at 7:58 Comment(2)
I'm split on whether to downvote or upvote this. The OP asks about size, not performance. On the other hand, this performance link might be handy. Could you add the code how exactly you squeeze page and object sizes out of watir-webdriver-performance?Opulent
I tested right now your idea. It actually returns: irb(main):031:0> b.performance.memory => { :js_heap_size_limit=>793000000, :total_js_heap_size=>12700000, :used_js_heap_size=>10000000} So, it is realted to browser memory, not to the page memory size.Zeniazenith

© 2022 - 2024 — McMap. All rights reserved.