1 2<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> 3<html><head><title>Python: module telemetry.internal.browser.extension_page</title> 4<meta charset="utf-8"> 5</head><body bgcolor="#f0f0f8"> 6 7<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="heading"> 8<tr bgcolor="#7799ee"> 9<td valign=bottom> <br> 10<font color="#ffffff" face="helvetica, arial"> <br><big><big><strong><a href="telemetry.html"><font color="#ffffff">telemetry</font></a>.<a href="telemetry.internal.html"><font color="#ffffff">internal</font></a>.<a href="telemetry.internal.browser.html"><font color="#ffffff">browser</font></a>.extension_page</strong></big></big></font></td 11><td align=right valign=bottom 12><font color="#ffffff" face="helvetica, arial"><a href=".">index</a><br><a href="../telemetry/internal/browser/extension_page.py">telemetry/internal/browser/extension_page.py</a></font></td></tr></table> 13 <p><tt># Copyright 2012 The Chromium Authors. All rights reserved.<br> 14# Use of this source code is governed by a BSD-style license that can be<br> 15# found in the LICENSE file.</tt></p> 16<p> 17<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section"> 18<tr bgcolor="#aa55cc"> 19<td colspan=3 valign=bottom> <br> 20<font color="#ffffff" face="helvetica, arial"><big><strong>Modules</strong></big></font></td></tr> 21 22<tr><td bgcolor="#aa55cc"><tt> </tt></td><td> </td> 23<td width="100%"><table width="100%" summary="list"><tr><td width="25%" valign=top><a href="re.html">re</a><br> 24</td><td width="25%" valign=top><a href="telemetry.internal.browser.web_contents.html">telemetry.internal.browser.web_contents</a><br> 25</td><td width="25%" valign=top></td><td width="25%" valign=top></td></tr></table></td></tr></table><p> 26<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section"> 27<tr bgcolor="#ee77aa"> 28<td colspan=3 valign=bottom> <br> 29<font color="#ffffff" face="helvetica, arial"><big><strong>Classes</strong></big></font></td></tr> 30 31<tr><td bgcolor="#ee77aa"><tt> </tt></td><td> </td> 32<td width="100%"><dl> 33<dt><font face="helvetica, arial"><a href="telemetry.internal.browser.web_contents.html#WebContents">telemetry.internal.browser.web_contents.WebContents</a>(<a href="__builtin__.html#object">__builtin__.object</a>) 34</font></dt><dd> 35<dl> 36<dt><font face="helvetica, arial"><a href="telemetry.internal.browser.extension_page.html#ExtensionPage">ExtensionPage</a> 37</font></dt></dl> 38</dd> 39</dl> 40 <p> 41<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section"> 42<tr bgcolor="#ffc8d8"> 43<td colspan=3 valign=bottom> <br> 44<font color="#000000" face="helvetica, arial"><a name="ExtensionPage">class <strong>ExtensionPage</strong></a>(<a href="telemetry.internal.browser.web_contents.html#WebContents">telemetry.internal.browser.web_contents.WebContents</a>)</font></td></tr> 45 46<tr bgcolor="#ffc8d8"><td rowspan=2><tt> </tt></td> 47<td colspan=2><tt>Represents an extension page in the browser<br> </tt></td></tr> 48<tr><td> </td> 49<td width="100%"><dl><dt>Method resolution order:</dt> 50<dd><a href="telemetry.internal.browser.extension_page.html#ExtensionPage">ExtensionPage</a></dd> 51<dd><a href="telemetry.internal.browser.web_contents.html#WebContents">telemetry.internal.browser.web_contents.WebContents</a></dd> 52<dd><a href="__builtin__.html#object">__builtin__.object</a></dd> 53</dl> 54<hr> 55Methods defined here:<br> 56<dl><dt><a name="ExtensionPage-Reload"><strong>Reload</strong></a>(self)</dt><dd><tt>Reloading an extension page is used as a workaround for an extension<br> 57binding bug for old versions of Chrome (crbug.com/263162). After Navigate<br> 58returns, we are guaranteed that the inspected page is in the correct state.</tt></dd></dl> 59 60<dl><dt><a name="ExtensionPage-__init__"><strong>__init__</strong></a>(self, inspector_backend)</dt></dl> 61 62<hr> 63Methods inherited from <a href="telemetry.internal.browser.web_contents.html#WebContents">telemetry.internal.browser.web_contents.WebContents</a>:<br> 64<dl><dt><a name="ExtensionPage-CloseConnections"><strong>CloseConnections</strong></a>(self)</dt><dd><tt>Closes all TCP sockets held open by the browser.<br> 65 <br> 66Raises:<br> 67 exceptions.DevtoolsTargetCrashException if the tab is not alive.</tt></dd></dl> 68 69<dl><dt><a name="ExtensionPage-EnableAllContexts"><strong>EnableAllContexts</strong></a>(self)</dt><dd><tt>Enable all contexts in a page. Returns the number of available contexts.<br> 70 <br> 71Raises:<br> 72 exceptions.WebSocketDisconnected<br> 73 exceptions.TimeoutException<br> 74 exceptions.DevtoolsTargetCrashException</tt></dd></dl> 75 76<dl><dt><a name="ExtensionPage-EvaluateJavaScript"><strong>EvaluateJavaScript</strong></a>(self, expr, timeout<font color="#909090">=90</font>)</dt><dd><tt>Evalutes expr in JavaScript and returns the JSONized result.<br> 77 <br> 78Consider using ExecuteJavaScript for cases where the result of the<br> 79expression is not needed.<br> 80 <br> 81If evaluation throws in JavaScript, a Python EvaluateException will<br> 82be raised.<br> 83 <br> 84If the result of the evaluation cannot be JSONized, then an<br> 85EvaluationException will be raised.<br> 86 <br> 87Raises:<br> 88 exceptions.Error: See <a href="#ExtensionPage-EvaluateJavaScriptInContext">EvaluateJavaScriptInContext</a>() for a detailed list<br> 89 of possible exceptions.</tt></dd></dl> 90 91<dl><dt><a name="ExtensionPage-EvaluateJavaScriptInContext"><strong>EvaluateJavaScriptInContext</strong></a>(self, expr, context_id, timeout<font color="#909090">=90</font>)</dt><dd><tt>Similar to ExecuteJavaScript, except context_id can refer to an iframe.<br> 92The main page has context_id=1, the first iframe context_id=2, etc.<br> 93 <br> 94Raises:<br> 95 exceptions.EvaluateException<br> 96 exceptions.WebSocketDisconnected<br> 97 exceptions.TimeoutException<br> 98 exceptions.DevtoolsTargetCrashException</tt></dd></dl> 99 100<dl><dt><a name="ExtensionPage-ExecuteJavaScript"><strong>ExecuteJavaScript</strong></a>(self, statement, timeout<font color="#909090">=90</font>)</dt><dd><tt>Executes statement in JavaScript. Does not return the result.<br> 101 <br> 102If the statement failed to evaluate, EvaluateException will be raised.<br> 103 <br> 104Raises:<br> 105 exceptions.Error: See <a href="#ExtensionPage-ExecuteJavaScriptInContext">ExecuteJavaScriptInContext</a>() for a detailed list of<br> 106 possible exceptions.</tt></dd></dl> 107 108<dl><dt><a name="ExtensionPage-ExecuteJavaScriptInContext"><strong>ExecuteJavaScriptInContext</strong></a>(self, expr, context_id, timeout<font color="#909090">=90</font>)</dt><dd><tt>Similar to ExecuteJavaScript, except context_id can refer to an iframe.<br> 109The main page has context_id=1, the first iframe context_id=2, etc.<br> 110 <br> 111Raises:<br> 112 exceptions.EvaluateException<br> 113 exceptions.WebSocketDisconnected<br> 114 exceptions.TimeoutException<br> 115 exceptions.DevtoolsTargetCrashException</tt></dd></dl> 116 117<dl><dt><a name="ExtensionPage-GetUrl"><strong>GetUrl</strong></a>(self)</dt><dd><tt>Returns the URL to which the <a href="telemetry.internal.browser.web_contents.html#WebContents">WebContents</a> is connected.<br> 118 <br> 119Raises:<br> 120 exceptions.Error: If there is an error in inspector backend connection.</tt></dd></dl> 121 122<dl><dt><a name="ExtensionPage-GetWebviewContexts"><strong>GetWebviewContexts</strong></a>(self)</dt><dd><tt>Returns a list of webview contexts within the current inspector backend.<br> 123 <br> 124Returns:<br> 125 A list of <a href="telemetry.internal.browser.web_contents.html#WebContents">WebContents</a> objects representing the webview contexts.<br> 126 <br> 127Raises:<br> 128 exceptions.Error: If there is an error in inspector backend connection.</tt></dd></dl> 129 130<dl><dt><a name="ExtensionPage-HasReachedQuiescence"><strong>HasReachedQuiescence</strong></a>(self)</dt><dd><tt>Determine whether the page has reached quiescence after loading.<br> 131 <br> 132Returns:<br> 133 True if 2 seconds have passed since last resource received, false<br> 134 otherwise.<br> 135Raises:<br> 136 exceptions.Error: See <a href="#ExtensionPage-EvaluateJavaScript">EvaluateJavaScript</a>() for a detailed list of<br> 137 possible exceptions.</tt></dd></dl> 138 139<dl><dt><a name="ExtensionPage-IsAlive"><strong>IsAlive</strong></a>(self)</dt><dd><tt>Whether the <a href="telemetry.internal.browser.web_contents.html#WebContents">WebContents</a> is still operating normally.<br> 140 <br> 141Since <a href="telemetry.internal.browser.web_contents.html#WebContents">WebContents</a> function asynchronously, this method does not guarantee<br> 142that the <a href="telemetry.internal.browser.web_contents.html#WebContents">WebContents</a> will still be alive at any point in the future.<br> 143 <br> 144Returns:<br> 145 A boolean indicating whether the <a href="telemetry.internal.browser.web_contents.html#WebContents">WebContents</a> is opearting normally.</tt></dd></dl> 146 147<dl><dt><a name="ExtensionPage-Navigate"><strong>Navigate</strong></a>(self, url, script_to_evaluate_on_commit<font color="#909090">=None</font>, timeout<font color="#909090">=90</font>)</dt><dd><tt>Navigates to url.<br> 148 <br> 149If |script_to_evaluate_on_commit| is given, the script source string will be<br> 150evaluated when the navigation is committed. This is after the context of<br> 151the page exists, but before any script on the page itself has executed.<br> 152 <br> 153Raises:<br> 154 exceptions.TimeoutException<br> 155 exceptions.DevtoolsTargetCrashException</tt></dd></dl> 156 157<dl><dt><a name="ExtensionPage-StartTimelineRecording"><strong>StartTimelineRecording</strong></a>(self)</dt><dd><tt>Starts timeline recording.<br> 158 <br> 159Raises:<br> 160 exceptions.TimeoutException<br> 161 exceptions.DevtoolsTargetCrashException</tt></dd></dl> 162 163<dl><dt><a name="ExtensionPage-StopTimelineRecording"><strong>StopTimelineRecording</strong></a>(self)</dt><dd><tt>Stops timeline recording.<br> 164 <br> 165Raises:<br> 166 exceptions.TimeoutException<br> 167 exceptions.DevtoolsTargetCrashException</tt></dd></dl> 168 169<dl><dt><a name="ExtensionPage-SynthesizeScrollGesture"><strong>SynthesizeScrollGesture</strong></a>(self, x<font color="#909090">=100</font>, y<font color="#909090">=800</font>, xDistance<font color="#909090">=0</font>, yDistance<font color="#909090">=-500</font>, xOverscroll<font color="#909090">=None</font>, yOverscroll<font color="#909090">=None</font>, preventFling<font color="#909090">=True</font>, speed<font color="#909090">=None</font>, gestureSourceType<font color="#909090">=None</font>, repeatCount<font color="#909090">=None</font>, repeatDelayMs<font color="#909090">=None</font>, interactionMarkerName<font color="#909090">=None</font>)</dt><dd><tt>Runs an inspector command that causes a repeatable browser driven scroll.<br> 170 <br> 171Args:<br> 172 x: X coordinate of the start of the gesture in CSS pixels.<br> 173 y: Y coordinate of the start of the gesture in CSS pixels.<br> 174 xDistance: Distance to scroll along the X axis (positive to scroll left).<br> 175 yDistance: Ddistance to scroll along the Y axis (positive to scroll up).<br> 176 xOverscroll: Number of additional pixels to scroll back along the X axis.<br> 177 xOverscroll: Number of additional pixels to scroll back along the Y axis.<br> 178 preventFling: Prevents a fling gesture.<br> 179 speed: Swipe speed in pixels per second.<br> 180 gestureSourceType: Which type of input events to be generated.<br> 181 repeatCount: Number of additional repeats beyond the first scroll.<br> 182 repeatDelayMs: Number of milliseconds delay between each repeat.<br> 183 interactionMarkerName: The name of the interaction markers to generate.<br> 184 <br> 185Raises:<br> 186 exceptions.TimeoutException<br> 187 exceptions.DevtoolsTargetCrashException</tt></dd></dl> 188 189<dl><dt><a name="ExtensionPage-WaitForDocumentReadyStateToBeComplete"><strong>WaitForDocumentReadyStateToBeComplete</strong></a>(self, timeout<font color="#909090">=90</font>)</dt><dd><tt>Waits for the document to finish loading.<br> 190 <br> 191Raises:<br> 192 exceptions.Error: See <a href="#ExtensionPage-WaitForJavaScriptExpression">WaitForJavaScriptExpression</a>() for a detailed list<br> 193 of possible exceptions.</tt></dd></dl> 194 195<dl><dt><a name="ExtensionPage-WaitForDocumentReadyStateToBeInteractiveOrBetter"><strong>WaitForDocumentReadyStateToBeInteractiveOrBetter</strong></a>(self, timeout<font color="#909090">=90</font>)</dt><dd><tt>Waits for the document to be interactive.<br> 196 <br> 197Raises:<br> 198 exceptions.Error: See <a href="#ExtensionPage-WaitForJavaScriptExpression">WaitForJavaScriptExpression</a>() for a detailed list<br> 199 of possible exceptions.</tt></dd></dl> 200 201<dl><dt><a name="ExtensionPage-WaitForJavaScriptExpression"><strong>WaitForJavaScriptExpression</strong></a>(self, expr, timeout, dump_page_state_on_timeout<font color="#909090">=True</font>)</dt><dd><tt>Waits for the given JavaScript expression to be True.<br> 202 <br> 203This method is robust against any given Evaluation timing out.<br> 204 <br> 205Args:<br> 206 expr: The expression to evaluate.<br> 207 timeout: The number of seconds to wait for the expression to be True.<br> 208 dump_page_state_on_timeout: Whether to provide additional information on<br> 209 the page state if a TimeoutException is thrown.<br> 210 <br> 211Raises:<br> 212 exceptions.TimeoutException: On a timeout.<br> 213 exceptions.Error: See <a href="#ExtensionPage-EvaluateJavaScript">EvaluateJavaScript</a>() for a detailed list of<br> 214 possible exceptions.</tt></dd></dl> 215 216<dl><dt><a name="ExtensionPage-WaitForNavigate"><strong>WaitForNavigate</strong></a>(self, timeout<font color="#909090">=90</font>)</dt><dd><tt>Waits for the navigation to complete.<br> 217 <br> 218The current page is expect to be in a navigation.<br> 219This function returns when the navigation is complete or when<br> 220the timeout has been exceeded.<br> 221 <br> 222Raises:<br> 223 exceptions.TimeoutException<br> 224 exceptions.DevtoolsTargetCrashException</tt></dd></dl> 225 226<hr> 227Data descriptors inherited from <a href="telemetry.internal.browser.web_contents.html#WebContents">telemetry.internal.browser.web_contents.WebContents</a>:<br> 228<dl><dt><strong>__dict__</strong></dt> 229<dd><tt>dictionary for instance variables (if defined)</tt></dd> 230</dl> 231<dl><dt><strong>__weakref__</strong></dt> 232<dd><tt>list of weak references to the object (if defined)</tt></dd> 233</dl> 234<dl><dt><strong>id</strong></dt> 235<dd><tt>Return the unique id string for this tab object.</tt></dd> 236</dl> 237<dl><dt><strong>message_output_stream</strong></dt> 238</dl> 239<dl><dt><strong>timeline_model</strong></dt> 240</dl> 241</td></tr></table></td></tr></table><p> 242<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section"> 243<tr bgcolor="#eeaa77"> 244<td colspan=3 valign=bottom> <br> 245<font color="#ffffff" face="helvetica, arial"><big><strong>Functions</strong></big></font></td></tr> 246 247<tr><td bgcolor="#eeaa77"><tt> </tt></td><td> </td> 248<td width="100%"><dl><dt><a name="-UrlToExtensionId"><strong>UrlToExtensionId</strong></a>(url)</dt></dl> 249</td></tr></table> 250</body></html>