OLD | NEW |
1 # Copyright 2016 The Chromium Authors. All rights reserved. | 1 # Copyright 2016 The Chromium Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 from page_sets.system_health import platforms | 5 from page_sets.system_health import platforms |
6 from page_sets.system_health import system_health_story | 6 from page_sets.system_health import system_health_story |
7 | 7 |
8 from page_sets.login_helpers import pinterest_login | 8 from page_sets.login_helpers import pinterest_login |
9 | 9 |
10 from telemetry import decorators | 10 from telemetry import decorators |
(...skipping 12 matching lines...) Expand all Loading... |
23 ABSTRACT_STORY = True | 23 ABSTRACT_STORY = True |
24 | 24 |
25 def _WaitForNavigation(self, action_runner): | 25 def _WaitForNavigation(self, action_runner): |
26 if not self.IS_SINGLE_PAGE_APP: | 26 if not self.IS_SINGLE_PAGE_APP: |
27 action_runner.WaitForNavigate() | 27 action_runner.WaitForNavigate() |
28 | 28 |
29 def _NavigateToItem(self, action_runner, index): | 29 def _NavigateToItem(self, action_runner, index): |
30 item_selector = 'document.querySelectorAll("%s")[%d]' % ( | 30 item_selector = 'document.querySelectorAll("%s")[%d]' % ( |
31 self.ITEM_SELECTOR, index) | 31 self.ITEM_SELECTOR, index) |
32 # Only scrolls if element is not currently in viewport. | 32 # Only scrolls if element is not currently in viewport. |
| 33 action_runner.WaitForElement(element_function=item_selector) |
33 action_runner.ScrollPageToElement(element_function=item_selector) | 34 action_runner.ScrollPageToElement(element_function=item_selector) |
34 self._ClickLink(action_runner, item_selector) | 35 self._ClickLink(action_runner, item_selector) |
35 | 36 |
36 def _ClickLink(self, action_runner, element_function): | 37 def _ClickLink(self, action_runner, element_function): |
37 action_runner.WaitForElement(element_function=element_function) | 38 action_runner.WaitForElement(element_function=element_function) |
38 action_runner.ClickElement(element_function=element_function) | 39 action_runner.ClickElement(element_function=element_function) |
39 self._WaitForNavigation(action_runner) | 40 self._WaitForNavigation(action_runner) |
40 | 41 |
41 def _NavigateBack(self, action_runner): | 42 def _NavigateBack(self, action_runner): |
42 action_runner.ExecuteJavaScript('window.history.back()') | 43 action_runner.ExecuteJavaScript('window.history.back()') |
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
359 inner_save_function = 'document.querySelector(".nameAndIcons")' | 360 inner_save_function = 'document.querySelector(".nameAndIcons")' |
360 action_runner.WaitForElement(element_function=inner_save_function) | 361 action_runner.WaitForElement(element_function=inner_save_function) |
361 action_runner.ClickElement(element_function=inner_save_function) | 362 action_runner.ClickElement(element_function=inner_save_function) |
362 action_runner.Wait(1) # Wait to make navigation realistic. | 363 action_runner.Wait(1) # Wait to make navigation realistic. |
363 | 364 |
364 # Close selection. | 365 # Close selection. |
365 x_element_function = ('document.querySelector(' | 366 x_element_function = ('document.querySelector(' |
366 '".Button.borderless.close.visible")') | 367 '".Button.borderless.close.visible")') |
367 action_runner.ClickElement(element_function=x_element_function) | 368 action_runner.ClickElement(element_function=x_element_function) |
368 action_runner.Wait(1) # Wait to make navigation realistic. | 369 action_runner.Wait(1) # Wait to make navigation realistic. |
OLD | NEW |