Error when tried to get the page load time
See original GitHub issueSource code
import json
from browsermobproxy import Server
from haralyzer import MultiHarParser
server = Server(
"/home/gblp090/Downloads/browsermob-proxy-2.1.0-beta-5/bin/browsermob-proxy")
server.start()
proxy = server.create_proxy()
from selenium import webdriver
profile = webdriver.FirefoxProfile()
profile.set_proxy(proxy.selenium_proxy())
driver = webdriver.Firefox(firefox_profile=profile)
proxy.new_har("google")
driver.get("http://www.google.com")
result = json.dumps(proxy.har, ensure_ascii=False)
file = open('CHARLIE_HAR.har', 'w+')
file.write(result)
file.close()
driver.quit()
# print result
test_runs = []
with open('CHARLIE_HAR.har', 'r') as f1:
test_runs.append((json.loads(f1.read())))
multi_har_parser = MultiHarParser(har_data=test_runs)
print multi_har_parser.page_load_time
server.stop()
error
Traceback (most recent call last):
File "tests/dummy_test.py", line 29, in <module>
print multi_har_parser.page_load_time
File "/home/gblp090/automation/CFMobileAutomation/env/local/lib/python2.7/site-packages/cached_property.py", line 26, in __get__
value = obj.__dict__[self.func.__name__] = self.func(obj)
File "/home/gblp090/automation/CFMobileAutomation/env/local/lib/python2.7/site-packages/haralyzer/multihar.py", line 141, in page_load_time
load_times = self.get_load_times('page')
File "/home/gblp090/automation/CFMobileAutomation/env/local/lib/python2.7/site-packages/haralyzer/multihar.py", line 76, in get_load_times
val = getattr(har_page, search_str, None)
File "/home/gblp090/automation/CFMobileAutomation/env/local/lib/python2.7/site-packages/cached_property.py", line 26, in __get__
value = obj.__dict__[self.func.__name__] = self.func(obj)
File "/home/gblp090/automation/CFMobileAutomation/env/local/lib/python2.7/site-packages/haralyzer/assets.py", line 460, in page_load_time
return self._get_asset_load('page')
File "/home/gblp090/automation/CFMobileAutomation/env/local/lib/python2.7/site-packages/haralyzer/assets.py", line 239, in _get_asset_load
return self.pageTimings['onLoad']
KeyError: 'onLoad'
pip list
apipkg (1.4)
Appium-Python-Client (0.22)
backports.statistics (0.1.0)
browsermob-proxy (0.7.1)
cached-property (1.3.0)
execnet (1.4.1)
haralyzer (1.4.5)
pip (8.1.1)
py (1.4.31)
pytest (2.9.1)
pytest-html (1.8.0)
pytest-rerunfailures (1.0.1)
pytest-timeout (1.0.0)
pytest-xdist (1.14)
python-dateutil (2.5.2)
requests (2.9.1)
selenium (2.53.1)
setuptools (18.0.1)
six (1.10.0)
wheel (0.24.0)
If I try to get any other load time it prints “0.0” Har gist If i paste the content of har file at http://www.softwareishard.com/har/viewer/ It shows the load time is it possible to do the same with this library.
Issue Analytics
- State:
- Created 7 years ago
- Comments:7
Top Results From Across the Web
5 Common Issues Slowing Down Page Load Time (And How ...
Poorly performing scripts within your website can be another reason for poor page load times. Badly written code, or simply code that hasn't ......
Read more >How to Fix Web Pages That Won't Load - Online Tech Tips
Check Out Our Dedicated Guide for Your Specific Web Page Error · Make Sure Your Internet Connection Is Working · Check if the...
Read more >10 Reasons for Slow Website Loading (With Solutions)
Understand these 10 core reasons for slow website loading and learn how to resolve these issues & your traffic, revenue, and credibility.
Read more >Why Do Websites Take Too Long to Respond - Mindspun
This error message is typically displayed if the server takes more than thirty seconds to respond to a user's request to view a...
Read more >Top 10 Reasons for Slow Loading Websites (And How to Fix It)
Here are our Top 10 Reasons for Slow Loading Websites. 1. Unoptimized Images. A large volume of unoptimized images is usually the most ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Cool, will work up another PR to address the remainder of the issue, thanks.
Hello @pr4bh4sh, it looks like bmp is not capable of adding full page load timings (which makes sense).
https://groups.google.com/forum/#!topic/browsermob-proxy/iiU2GMr0m2s
I am working on a fallback that would add up the total load time of all elements, and am taking a look into the
0.0
results you are getting, hope to open a pull request soon unless you see something first 😄