Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(431)

Unified Diff: telemetry/telemetry/internal/actions/action_runner.py

Issue 2617503002: [telemetry] Let ScrollToElement callers pass root (Closed)
Patch Set: disable on android Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | telemetry/telemetry/internal/actions/action_runner_unittest.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: telemetry/telemetry/internal/actions/action_runner.py
diff --git a/telemetry/telemetry/internal/actions/action_runner.py b/telemetry/telemetry/internal/actions/action_runner.py
index b927427c6741da919b17c5081a88a40f4908e78a..9c3030feb888067c70e58bdcd59544cd32b2b893 100644
--- a/telemetry/telemetry/internal/actions/action_runner.py
+++ b/telemetry/telemetry/internal/actions/action_runner.py
@@ -430,18 +430,33 @@ class ActionRunner(object):
use_touch=use_touch, synthetic_gesture_source=synthetic_gesture_source))
def ScrollPageToElement(self, selector=None, element_function=None,
+ container_selector=None,
+ container_element_function=None,
speed_in_pixels_per_second=800):
- """Perform scroll gesture on page until an element is in view.
+ """Perform scroll gesture on container until an element is in view.
+
+ Both the element and the container can be specified by a CSS selector
+ xor a JavaScript function, provided as a string, which returns an element.
+ The element is required so exactly one of selector and element_function
+ must be provided. The container is optional so at most one of
+ container_selector and container_element_function can be provided.
+ The container defaults to document.scrollingElement or document.body if
+ scrollingElement is not set.
Args:
selector: A CSS selector describing the element.
element_function: A JavaScript function (as string) that is used
to retrieve the element. For example:
'function() { return foo.element; }'.
+ container_selector: A CSS selector describing the container element.
+ container_element_function: A JavaScript function (as a string) that is
+ used to retrieve the container element.
speed_in_pixels_per_second: Speed to scroll.
"""
self._RunAction(ScrollToElementAction(
selector=selector, element_function=element_function,
+ container_selector=container_selector,
+ container_element_function=container_element_function,
speed_in_pixels_per_second=speed_in_pixels_per_second))
def RepeatableBrowserDrivenScroll(self, x_scroll_distance_ratio=0.0,
« no previous file with comments | « no previous file | telemetry/telemetry/internal/actions/action_runner_unittest.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698