Web page load times using ui.webview
I used the code posted in this thread https://forum.omz-software.com/topic/4435/open-multiple-web-browser-tabs/13 that discusses opening multiple tabs on safari which worked to open the tabs.
As an additional level I am interested in profiling the web page load times for each tab.
According to the Pythonista documentation on ui there is a delegate method that case be used to listen in on the outcome as mentioned here - http://omz-software.com/pythonista/docs/ios/ui.html#webview
class MyWebViewDelegate (object):
def webview_should_start_load(self, webview, url, nav_type):
def webview_did_start_load(self, webview):
def webview_did_finish_load(self, webview):
def webview_did_fail_load(self, webview, error_code, error_msg):
I guess my question is how do I attach a delegate action with each tab load and use the markers webview_did_start_load and webview_did_finish_load to compute the load times?
Any pointers will be appreciated.
@champak, there are several different answers depending on what you are trying to accomplish.
Do you want to:
- Measure full rendered load times in Safari (and it is important that it is full Safari)
- Measure full rendered load times in some browser (and it is important that they are visibly rendered, i.e. you expect the rendering to take a significant amount of time)
- Measure the load time of all page components, of different pages (And it is important nothing gets cached between the pages)
- Measure the load time of a set of ”tabs” (and the only thing that matters is the overall load time of the whole ”package” of pages)
Thanks much for your response - appreciate it!
To answer your question, my requirements is a combination of 2 and 3 and to be more precise -
I am trying to measure the load time of all page components of different pages (each page renders a different html site / content) across different browsers -
Tab 1 - https://www.microsoft.com
Tab 2 - https://www.msn.com
Tab 3 - https://www.cnn.com
Tab 4 - https://www.nytimes.com
And I want to measure it across let's say 10 iterations with opening and closing the browser each time and making sure nothing is stored on the cache (clean on exit).
Thanks for your help and appreciate any pointers on this.