| OLD | NEW |
| (Empty) |
| 1 | |
| 2 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> | |
| 3 <html><head><title>Python: module telemetry.internal.browser.web_contents</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 hre
f="telemetry.html"><font color="#ffffff">telemetry</font></a>.<a href="telemetry
.internal.html"><font color="#ffffff">internal</font></a>.<a href="telemetry.int
ernal.browser.html"><font color="#ffffff">browser</font></a>.web_contents</stron
g></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/web_contents.py">telemetry/internal/browser/web_c
ontents.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=t
op><a href="telemetry.core.exceptions.html">telemetry.core.exceptions</a><br> | |
| 24 </td><td width="25%" valign=top><a href="os.html">os</a><br> | |
| 25 </td><td width="25%" valign=top><a href="telemetry.core.util.html">telemetry.cor
e.util</a><br> | |
| 26 </td><td width="25%" valign=top></td></tr></table></td></tr></table><p> | |
| 27 <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section"> | |
| 28 <tr bgcolor="#ee77aa"> | |
| 29 <td colspan=3 valign=bottom> <br> | |
| 30 <font color="#ffffff" face="helvetica, arial"><big><strong>Classes</strong></big
></font></td></tr> | |
| 31 | |
| 32 <tr><td bgcolor="#ee77aa"><tt> </tt></td><td>
</td> | |
| 33 <td width="100%"><dl> | |
| 34 <dt><font face="helvetica, arial"><a href="__builtin__.html#object">__builtin__.
object</a> | |
| 35 </font></dt><dd> | |
| 36 <dl> | |
| 37 <dt><font face="helvetica, arial"><a href="telemetry.internal.browser.web_conten
ts.html#WebContents">WebContents</a> | |
| 38 </font></dt></dl> | |
| 39 </dd> | |
| 40 </dl> | |
| 41 <p> | |
| 42 <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section"> | |
| 43 <tr bgcolor="#ffc8d8"> | |
| 44 <td colspan=3 valign=bottom> <br> | |
| 45 <font color="#000000" face="helvetica, arial"><a name="WebContents">class <stron
g>WebContents</strong></a>(<a href="__builtin__.html#object">__builtin__.object<
/a>)</font></td></tr> | |
| 46 | |
| 47 <tr bgcolor="#ffc8d8"><td rowspan=2><tt> </tt></td> | |
| 48 <td colspan=2><tt>Represents web contents in the browse
r<br> </tt></td></tr> | |
| 49 <tr><td> </td> | |
| 50 <td width="100%">Methods defined here:<br> | |
| 51 <dl><dt><a name="WebContents-CloseConnections"><strong>CloseConnections</strong>
</a>(self)</dt><dd><tt>Closes all TCP sockets held open
by the browser.<br> | |
| 52 <br> | |
| 53 Raises:<br> | |
| 54 exceptions.DevtoolsTargetCrashException if the tab&nb
sp;is not alive.</tt></dd></dl> | |
| 55 | |
| 56 <dl><dt><a name="WebContents-EnableAllContexts"><strong>EnableAllContexts</stron
g></a>(self)</dt><dd><tt>Enable all contexts in a page.
Returns the number of available contexts.<br> | |
| 57 <br> | |
| 58 Raises:<br> | |
| 59 exceptions.WebSocketDisconnected<br> | |
| 60 exceptions.TimeoutException<br> | |
| 61 exceptions.DevtoolsTargetCrashException</tt></dd></dl> | |
| 62 | |
| 63 <dl><dt><a name="WebContents-EvaluateJavaScript"><strong>EvaluateJavaScript</str
ong></a>(self, expr, timeout<font color="#909090">=90</font>)</dt><dd><tt>Evalut
es expr in JavaScript and returns the JSONize
d result.<br> | |
| 64 <br> | |
| 65 Consider using ExecuteJavaScript for cases where t
he result of the<br> | |
| 66 expression is not needed.<br> | |
| 67 <br> | |
| 68 If evaluation throws in JavaScript, a Python
EvaluateException will<br> | |
| 69 be raised.<br> | |
| 70 <br> | |
| 71 If the result of the evaluation cannot be&nbs
p;JSONized, then an<br> | |
| 72 EvaluationException will be raised.<br> | |
| 73 <br> | |
| 74 Raises:<br> | |
| 75 exceptions.Error: See <a href="#WebContents-EvaluateJavaSc
riptInContext">EvaluateJavaScriptInContext</a>() for a detailed&n
bsp;list<br> | |
| 76 of possible exceptions.</tt></dd></dl> | |
| 77 | |
| 78 <dl><dt><a name="WebContents-EvaluateJavaScriptInContext"><strong>EvaluateJavaSc
riptInContext</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> | |
| 79 The main page has context_id=1, the first ifr
ame context_id=2, etc.<br> | |
| 80 <br> | |
| 81 Raises:<br> | |
| 82 exceptions.EvaluateException<br> | |
| 83 exceptions.WebSocketDisconnected<br> | |
| 84 exceptions.TimeoutException<br> | |
| 85 exceptions.DevtoolsTargetCrashException</tt></dd></dl> | |
| 86 | |
| 87 <dl><dt><a name="WebContents-ExecuteJavaScript"><strong>ExecuteJavaScript</stron
g></a>(self, statement, timeout<font color="#909090">=90</font>)</dt><dd><tt>Exe
cutes statement in JavaScript. Does not return&nbs
p;the result.<br> | |
| 88 <br> | |
| 89 If the statement failed to evaluate, EvaluateExcep
tion will be raised.<br> | |
| 90 <br> | |
| 91 Raises:<br> | |
| 92 exceptions.Error: See <a href="#WebContents-ExecuteJavaScr
iptInContext">ExecuteJavaScriptInContext</a>() for a detailed&nbs
p;list of<br> | |
| 93 possible exceptions.</tt></dd></dl> | |
| 94 | |
| 95 <dl><dt><a name="WebContents-ExecuteJavaScriptInContext"><strong>ExecuteJavaScri
ptInContext</strong></a>(self, expr, context_id, timeout<font color="#909090">=9
0</font>)</dt><dd><tt>Similar to ExecuteJavaScript, except c
ontext_id can refer to an iframe.<br> | |
| 96 The main page has context_id=1, the first ifr
ame context_id=2, etc.<br> | |
| 97 <br> | |
| 98 Raises:<br> | |
| 99 exceptions.EvaluateException<br> | |
| 100 exceptions.WebSocketDisconnected<br> | |
| 101 exceptions.TimeoutException<br> | |
| 102 exceptions.DevtoolsTargetCrashException</tt></dd></dl> | |
| 103 | |
| 104 <dl><dt><a name="WebContents-GetUrl"><strong>GetUrl</strong></a>(self)</dt><dd><
tt>Returns the URL to which the <a href="#WebConte
nts">WebContents</a> is connected.<br> | |
| 105 <br> | |
| 106 Raises:<br> | |
| 107 exceptions.Error: If there is an error 
;in inspector backend connection.</tt></dd></dl> | |
| 108 | |
| 109 <dl><dt><a name="WebContents-GetWebviewContexts"><strong>GetWebviewContexts</str
ong></a>(self)</dt><dd><tt>Returns a list of webview co
ntexts within the current inspector backend.<br> | |
| 110 <br> | |
| 111 Returns:<br> | |
| 112 A list of <a href="#WebContents">WebContents</a> 
;objects representing the webview contexts.<br> | |
| 113 <br> | |
| 114 Raises:<br> | |
| 115 exceptions.Error: If there is an error 
;in inspector backend connection.</tt></dd></dl> | |
| 116 | |
| 117 <dl><dt><a name="WebContents-HasReachedQuiescence"><strong>HasReachedQuiescence<
/strong></a>(self)</dt><dd><tt>Determine whether the page ha
s reached quiescence after loading.<br> | |
| 118 <br> | |
| 119 Returns:<br> | |
| 120 True if 2 seconds have passed since&nb
sp;last resource received, false<br> | |
| 121 otherwise.<br> | |
| 122 Raises:<br> | |
| 123 exceptions.Error: See <a href="#WebContents-EvaluateJavaSc
ript">EvaluateJavaScript</a>() for a detailed list of<b
r> | |
| 124 possible exceptions.</tt></dd></dl> | |
| 125 | |
| 126 <dl><dt><a name="WebContents-IsAlive"><strong>IsAlive</strong></a>(self)</dt><dd
><tt>Whether the <a href="#WebContents">WebContents</a> is s
till operating normally.<br> | |
| 127 <br> | |
| 128 Since <a href="#WebContents">WebContents</a> function asynchronou
sly, this method does not guarantee<br> | |
| 129 that the <a href="#WebContents">WebContents</a> will still&n
bsp;be alive at any point in the future.<br> | |
| 130 <br> | |
| 131 Returns:<br> | |
| 132 A boolean indicating whether the <a href="#
WebContents">WebContents</a> is opearting normally.</tt></dd></dl
> | |
| 133 | |
| 134 <dl><dt><a name="WebContents-Navigate"><strong>Navigate</strong></a>(self, url,
script_to_evaluate_on_commit<font color="#909090">=None</font>, timeout<font col
or="#909090">=90</font>)</dt><dd><tt>Navigates to url.<br> | |
| 135 <br> | |
| 136 If |script_to_evaluate_on_commit| is given, the script&
nbsp;source string will be<br> | |
| 137 evaluated when the navigation is committed. This&n
bsp;is after the context of<br> | |
| 138 the page exists, but before any script on&nbs
p;the page itself has executed.<br> | |
| 139 <br> | |
| 140 Raises:<br> | |
| 141 exceptions.TimeoutException<br> | |
| 142 exceptions.DevtoolsTargetCrashException</tt></dd></dl> | |
| 143 | |
| 144 <dl><dt><a name="WebContents-StartTimelineRecording"><strong>StartTimelineRecord
ing</strong></a>(self)</dt><dd><tt>Starts timeline recording.<br> | |
| 145 <br> | |
| 146 Raises:<br> | |
| 147 exceptions.TimeoutException<br> | |
| 148 exceptions.DevtoolsTargetCrashException</tt></dd></dl> | |
| 149 | |
| 150 <dl><dt><a name="WebContents-StopTimelineRecording"><strong>StopTimelineRecordin
g</strong></a>(self)</dt><dd><tt>Stops timeline recording.<br> | |
| 151 <br> | |
| 152 Raises:<br> | |
| 153 exceptions.TimeoutException<br> | |
| 154 exceptions.DevtoolsTargetCrashException</tt></dd></dl> | |
| 155 | |
| 156 <dl><dt><a name="WebContents-SynthesizeScrollGesture"><strong>SynthesizeScrollGe
sture</strong></a>(self, x<font color="#909090">=100</font>, y<font color="#9090
90">=800</font>, xDistance<font color="#909090">=0</font>, yDistance<font color=
"#909090">=-500</font>, xOverscroll<font color="#909090">=None</font>, yOverscro
ll<font color="#909090">=None</font>, preventFling<font color="#909090">=True</f
ont>, speed<font color="#909090">=None</font>, gestureSourceType<font color="#90
9090">=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> | |
| 157 <br> | |
| 158 Args:<br> | |
| 159 x: X coordinate of the start of t
he gesture in CSS pixels.<br> | |
| 160 y: Y coordinate of the start of t
he gesture in CSS pixels.<br> | |
| 161 xDistance: Distance to scroll along the&nbs
p;X axis (positive to scroll left).<br> | |
| 162 yDistance: Ddistance to scroll along the&nb
sp;Y axis (positive to scroll up).<br> | |
| 163 xOverscroll: Number of additional pixels to
scroll back along the X axis.<br> | |
| 164 xOverscroll: Number of additional pixels to
scroll back along the Y axis.<br> | |
| 165 preventFling: Prevents a fling gesture.<br> | |
| 166 speed: Swipe speed in pixels per secon
d.<br> | |
| 167 gestureSourceType: Which type of input even
ts to be generated.<br> | |
| 168 repeatCount: Number of additional repeats b
eyond the first scroll.<br> | |
| 169 repeatDelayMs: Number of milliseconds delay 
;between each repeat.<br> | |
| 170 interactionMarkerName: The name of the inte
raction markers to generate.<br> | |
| 171 <br> | |
| 172 Raises:<br> | |
| 173 exceptions.TimeoutException<br> | |
| 174 exceptions.DevtoolsTargetCrashException</tt></dd></dl> | |
| 175 | |
| 176 <dl><dt><a name="WebContents-WaitForDocumentReadyStateToBeComplete"><strong>Wait
ForDocumentReadyStateToBeComplete</strong></a>(self, timeout<font color="#909090
">=90</font>)</dt><dd><tt>Waits for the document to fin
ish loading.<br> | |
| 177 <br> | |
| 178 Raises:<br> | |
| 179 exceptions.Error: See <a href="#WebContents-WaitForJavaScr
iptExpression">WaitForJavaScriptExpression</a>() for a detailed&n
bsp;list<br> | |
| 180 of possible exceptions.</tt></dd></dl> | |
| 181 | |
| 182 <dl><dt><a name="WebContents-WaitForDocumentReadyStateToBeInteractiveOrBetter"><
strong>WaitForDocumentReadyStateToBeInteractiveOrBetter</strong></a>(self, timeo
ut<font color="#909090">=90</font>)</dt><dd><tt>Waits for the doc
ument to be interactive.<br> | |
| 183 <br> | |
| 184 Raises:<br> | |
| 185 exceptions.Error: See <a href="#WebContents-WaitForJavaScr
iptExpression">WaitForJavaScriptExpression</a>() for a detailed&n
bsp;list<br> | |
| 186 of possible exceptions.</tt></dd></dl> | |
| 187 | |
| 188 <dl><dt><a name="WebContents-WaitForJavaScriptExpression"><strong>WaitForJavaScr
iptExpression</strong></a>(self, expr, timeout, dump_page_state_on_timeout<font
color="#909090">=True</font>)</dt><dd><tt>Waits for the given&nbs
p;JavaScript expression to be True.<br> | |
| 189 <br> | |
| 190 This method is robust against any given Evalu
ation timing out.<br> | |
| 191 <br> | |
| 192 Args:<br> | |
| 193 expr: The expression to evaluate.<br> | |
| 194 timeout: The number of seconds to wait
for the expression to be True.<br> | |
| 195 dump_page_state_on_timeout: Whether to provide a
dditional information on<br> | |
| 196 the page state if a 
;TimeoutException is thrown.<br> | |
| 197 <br> | |
| 198 Raises:<br> | |
| 199 exceptions.TimeoutException: On a timeout.<br> | |
| 200 exceptions.Error: See <a href="#WebContents-EvaluateJavaSc
ript">EvaluateJavaScript</a>() for a detailed list of<b
r> | |
| 201 possible exceptions.</tt></dd></dl> | |
| 202 | |
| 203 <dl><dt><a name="WebContents-WaitForNavigate"><strong>WaitForNavigate</strong></
a>(self, timeout<font color="#909090">=90</font>)</dt><dd><tt>Waits for&nbs
p;the navigation to complete.<br> | |
| 204 <br> | |
| 205 The current page is expect to be in a&nb
sp;navigation.<br> | |
| 206 This function returns when the navigation is
complete or when<br> | |
| 207 the timeout has been exceeded.<br> | |
| 208 <br> | |
| 209 Raises:<br> | |
| 210 exceptions.TimeoutException<br> | |
| 211 exceptions.DevtoolsTargetCrashException</tt></dd></dl> | |
| 212 | |
| 213 <dl><dt><a name="WebContents-__init__"><strong>__init__</strong></a>(self, inspe
ctor_backend)</dt></dl> | |
| 214 | |
| 215 <hr> | |
| 216 Data descriptors defined here:<br> | |
| 217 <dl><dt><strong>__dict__</strong></dt> | |
| 218 <dd><tt>dictionary for instance variables (if defined)<
/tt></dd> | |
| 219 </dl> | |
| 220 <dl><dt><strong>__weakref__</strong></dt> | |
| 221 <dd><tt>list of weak references to the object 
;(if defined)</tt></dd> | |
| 222 </dl> | |
| 223 <dl><dt><strong>id</strong></dt> | |
| 224 <dd><tt>Return the unique id string for this
tab object.</tt></dd> | |
| 225 </dl> | |
| 226 <dl><dt><strong>message_output_stream</strong></dt> | |
| 227 </dl> | |
| 228 <dl><dt><strong>timeline_model</strong></dt> | |
| 229 </dl> | |
| 230 </td></tr></table></td></tr></table><p> | |
| 231 <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section"> | |
| 232 <tr bgcolor="#55aa55"> | |
| 233 <td colspan=3 valign=bottom> <br> | |
| 234 <font color="#ffffff" face="helvetica, arial"><big><strong>Data</strong></big></
font></td></tr> | |
| 235 | |
| 236 <tr><td bgcolor="#55aa55"><tt> </tt></td><td>
</td> | |
| 237 <td width="100%"><strong>DEFAULT_WEB_CONTENTS_TIMEOUT</strong> = 90</td></tr></t
able> | |
| 238 </body></html> | |
| OLD | NEW |