|  |  | 
__builtin__.object
telemetry.core.browser.Browser
optparse.Values
telemetry.core.browser_options.BrowserOptions
telemetry.core.web_contents.WebContents(__builtin__.object)
telemetry.core.tab.Tab
telemetry.page.page_test.PageTest(__builtin__.object)
telemetry.page.page_measurement.PageMeasurement
 
 
| class Browser(__builtin__.object)
 |  |  | A running browser instance that can be controlled in a limited way. 
 To create a browser instance, use browser_finder.FindBrowser.
 
 Be sure to clean up after yourself by calling Close() when you are done with
 the browser. Or better yet:
 browser_to_create = FindBrowser(options)
 with browser_to_create.Create() as browser:
 ... do all your operations on browser here
 
 |  |  | Methods defined here: 
 Close(self)Closes this browser.
 GetStackTrace(self)
 GetStandardOutput(self)
 GetTraceResultAndReset(self)Returns the result of the trace, as TraceResult object.
 SetHTTPServerDirectories(self, paths)Returns True if the HTTP server was started, False otherwise.
 SetReplayArchivePath(self, archive_path, append_to_existing_wpr=False, make_javascript_deterministic=True)
 StartProfiling(self, options, base_output_file)Starts profiling using |options|.profiler_tool. Results are saved to|base_output_file|.<process_name>.
 StartTracing(self, custom_categories=None, timeout=10)
 StopProfiling(self)Stops all active profilers and saves their results.
 StopTracing(self)
 __enter__(self)
 __exit__(self, *args)
 __init__(self, backend, platform_backend)
 is_profiler_active(self, profiler_name)
 Data descriptors defined here:
 
 __dict__dictionary for instance variables (if defined)
 __weakref__list of weak references to the object (if defined)
 browser_type
 extensionsReturns the extension dictionary if it exists.
 http_server
 io_statsReturns a dict of IO statistics for the browser:{ 'Browser': {
 'ReadOperationCount': W,
 'WriteOperationCount': X,
 'ReadTransferCount': Y,
 'WriteTransferCount': Z
 },
 'Gpu': {
 'ReadOperationCount': W,
 'WriteOperationCount': X,
 'ReadTransferCount': Y,
 'WriteTransferCount': Z
 },
 'Renderer': {
 'ReadOperationCount': W,
 'WriteOperationCount': X,
 'ReadTransferCount': Y,
 'WriteTransferCount': Z
 }
 }
 is_content_shellReturns whether this browser is a content shell, only.
 memory_statsReturns a dict of memory statistics for the browser:{ 'Browser': {
 'VM': S,
 'VMPeak': T,
 'WorkingSetSize': U,
 'WorkingSetSizePeak': V,
 'ProportionalSetSize': W,
 'PrivateDirty': X
 },
 'Gpu': {
 'VM': S,
 'VMPeak': T,
 'WorkingSetSize': U,
 'WorkingSetSizePeak': V,
 'ProportionalSetSize': W,
 'PrivateDirty': X
 },
 'Renderer': {
 'VM': S,
 'VMPeak': T,
 'WorkingSetSize': U,
 'WorkingSetSizePeak': V,
 'ProportionalSetSize': W,
 'PrivateDirty': X
 },
 'SystemCommitCharge': Y,
 'ProcessCount': Z,
 }
 Any of the above keys may be missing on a per-platform basis.
 platform
 supports_extensions
 supports_tab_control
 supports_tracing
 tabs
 |  
 
| class BrowserOptions(optparse.Values)
 |  |  | Options to be used for discovering and launching a browser. 
 |  |  | Methods defined here: 
 AppendExtraBrowserArg(self, arg)
 Copy(self)
 CreateParser(self, *args, **kwargs)
 __init__(self, browser_type=None)
 Methods inherited from optparse.Values:
 
 __cmp__(self, other)
 __repr__ = _repr(self)
 __str__(self)
 ensure_value(self, attr, value)
 read_file(self, filename, mode='careful')
 read_module(self, modname, mode='careful')
 |  
 
| class PageMeasurement(telemetry.page.page_test.PageTest)
 |  |  | Glue code for running a measurement across a set of pages. 
 To use this, subclass from the measurement and override MeasurePage. For
 example:
 
 class BodyChildElementMeasurement(PageMeasurement):
 def MeasurePage(self, page, tab, results):
 body_child_count = tab.EvaluateJavaScript(
 'document.body.children.length')
 results.Add('body_children', 'count', body_child_count)
 
 if __name__ == '__main__':
 page_measurement.Main(BodyChildElementMeasurement())
 
 To add test-specific options:
 
 class BodyChildElementMeasurement(PageMeasurement):
 def AddCommandLineOptions(parser):
 parser.add_option('--element', action='store', default='body')
 
 def MeasurePage(self, page, tab, results):
 body_child_count = tab.EvaluateJavaScript(
 'document.querySelector('%s').children.length')
 results.Add('children', 'count', child_count)
 
 |  |  | Method resolution order:PageMeasurementtelemetry.page.page_test.PageTest__builtin__.object
 Methods defined here:
 
 AddOutputOptions(self, parser)
 MeasurePage(self, page, tab, results)Override to actually measure the page's performance.
 page is a page_set.Page
 tab is an instance of telemetry.core.Tab
 
 Should call results.Add(name, units, value) for each result, or raise an
 exception on failure. The name and units of each Add() call must be
 the same across all iterations. The name 'url' must not be used.
 
 Prefer field names that are in accordance with python variable style. E.g.
 field_name.
 
 Put together:
 
 def MeasurePage(self, page, tab, results):
 res = tab.EvaluateJavaScript('2+2')
 if res != 4:
 raise Exception('Oh, wow.')
 results.Add('two_plus_two', 'count', res)
 PrepareResults(self, options)
 __init__(self, action_name_to_run='', needs_browser_restart_after_each_run=False, discard_first_result=False, clear_cache_before_each_run=False)
 Data descriptors defined here:
 
 output_format_choices
 results_are_the_same_on_every_pageBy default, measurements are assumed to output the same values for everypage. This allows incremental output, for example in CSV. If, however, the
 measurement discovers what values it can report as it goes, and those values
 may vary from page to page, you need to override this function and return
 False. Output will not appear in this mode until the entire pageset has
 run.
 Methods inherited from telemetry.page.page_test.PageTest:
 
 AddCommandLineOptions(self, parser)Override to expose command-line options for this test.
 The provided parser is an optparse.OptionParser instance and accepts all
 normal results. The parsed options are available in Run as
 self.options.
 CanRunForPage(self, page)Override to customize if the test can be ran for the given page.
 CreatePageSet(self, args, options)Override to make this test generate its own page set instead ofallowing arbitrary page sets entered from the command-line.
 CustomizeBrowserOptions(self, options)Override to add test-specific options to the BrowserOptions object
 CustomizeBrowserOptionsForPage(self, page, options)Add options specific to the test and the given page.
 DidNavigateToPage(self, page, tab)Override to do operations right after the page is navigated, but beforeany waiting for completion has occurred.
 DidRunAction(self, page, tab, action)Override to do operations after running the action on the page.
 DidRunPageSet(self, tab, results)Override to do operations after page set is completed, but before browseris torn down.
 DidStartHTTPServer(self, tab)Override to do operations after the HTTP server is started.
 NeedsBrowserRestartAfterEachRun(self, tab)Override to specify browser restart after each run.
 Run(self, options, page, tab, results)
 SetUpBrowser(self, browser)Override to customize the browser right after it has launched.
 WillNavigateToPage(self, page, tab)Override to do operations before the page is navigated.
 WillRunAction(self, page, tab, action)Override to do operations before running the action on the page.
 WillRunPageSet(self, tab)Override to do operations before the page set is navigated.
 Data descriptors inherited from telemetry.page.page_test.PageTest:
 
 __dict__dictionary for instance variables (if defined)
 __weakref__list of weak references to the object (if defined)
 action_name_to_run
 clear_cache_before_each_runWhen set to True, the browser's disk and memory cache will be clearedbefore each run.
 discard_first_resultWhen set to True, the first run of the test is discarded.  This isuseful for cases where it's desirable to have some test resource cached so
 the first run of the test can warm things up.
 |  
 
| class Tab(telemetry.core.web_contents.WebContents)
 |  |  | Represents a tab in the browser 
 The important parts of the Tab object are in the runtime and page objects.
 E.g.:
 # Navigates the tab to a given url.
 tab.Navigate('http://www.google.com/')
 
 # Evaluates 1+1 in the tab's JavaScript context.
 tab.Evaluate('1+1')
 
 |  |  | Method resolution order:Tabtelemetry.core.web_contents.WebContents__builtin__.object
 Methods defined here:
 
 Activate(self)Brings this tab to the foreground asynchronously.
 Not all browsers or browser versions support this method.
 Be sure to check browser.supports_tab_control.
 
 Please note: this is asynchronous. There is a delay between this call
 and the page's documentVisibilityState becoming 'visible', and yet more
 delay until the actual tab is visible to the user. None of these delays
 are included in this call.
 ClearCache(self)Clears the browser's HTTP disk cache and the tab's HTTP memory cache.
 CollectGarbage(self)
 GetCookieByName(self, name, timeout=60)Returns the value of the cookie by the given |name|.
 Navigate(self, url, script_to_evaluate_on_commit=None, timeout=60)Navigates to url.
 If |script_to_evaluate_on_commit| is given, the script source string will be
 evaluated when the navigation is committed. This is after the context of
 the page exists, but before any script on the page itself has executed.
 PerformActionAndWaitForNavigate(self, action_function, timeout=60)Executes action_function, and waits for the navigation to complete.
 action_function must be a Python function that results in a navigation.
 This function returns when the navigation is complete or when
 the timeout has been exceeded.
 Screenshot(self, timeout=60)Capture a screenshot of the window for rendering validation
 __del__(self)
 __init__(self, inspector_backend)
 Data descriptors defined here:
 
 browserThe browser in which this tab resides.
 dom_statsA dictionary populated with measured DOM statistics.
 Currently this dictionary contains:
 {
 'document_count': integer,
 'node_count': integer,
 'event_listener_count': integer
 }
 screenshot_supportedTrue if the browser instance is capable of capturing screenshots
 url
 Methods inherited from telemetry.core.web_contents.WebContents:
 
 Close(self)Closes this page.
 Not all browsers or browser versions support this method.
 Be sure to check browser.supports_tab_control.
 Disconnect(self)
 EvaluateJavaScript(self, expr, timeout=60)Evalutes expr in JavaScript and returns the JSONized result.
 Consider using ExecuteJavaScript for cases where the result of the
 expression is not needed.
 
 If evaluation throws in JavaScript, a Python EvaluateException will
 be raised.
 
 If the result of the evaluation cannot be JSONized, then an
 EvaluationException will be raised.
 ExecuteJavaScript(self, expr, timeout=60)Executes expr in JavaScript. Does not return the result.
 If the expression failed to evaluate, EvaluateException will be raised.
 StartTimelineRecording(self)
 StopTimelineRecording(self)
 WaitForDocumentReadyStateToBeComplete(self, timeout=60)
 WaitForDocumentReadyStateToBeInteractiveOrBetter(self, timeout=60)
 Data descriptors inherited from telemetry.core.web_contents.WebContents:
 
 __dict__dictionary for instance variables (if defined)
 __weakref__list of weak references to the object (if defined)
 message_output_stream
 timeline_model
 |  |