OLD | NEW |
1 # encoding: utf-8 | 1 # encoding: utf-8 |
2 # Copyright 2016 The Chromium Authors. All rights reserved. | 2 # Copyright 2016 The Chromium Authors. All rights reserved. |
3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
5 | 5 |
6 from page_sets.system_health import platforms | 6 from page_sets.system_health import platforms |
7 from page_sets.system_health import system_health_story | 7 from page_sets.system_health import system_health_story |
8 | 8 |
9 from page_sets.login_helpers import pinterest_login | 9 from page_sets.login_helpers import pinterest_login |
10 | 10 |
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
215 IS_SINGLE_PAGE_APP = True | 215 IS_SINGLE_PAGE_APP = True |
216 ITEM_SELECTOR = '.hed > a' | 216 ITEM_SELECTOR = '.hed > a' |
217 SUPPORTED_PLATFORMS = platforms.MOBILE_ONLY | 217 SUPPORTED_PLATFORMS = platforms.MOBILE_ONLY |
218 _CLOSE_BUTTON_SELECTOR = '.close' | 218 _CLOSE_BUTTON_SELECTOR = '.close' |
219 | 219 |
220 def _DidLoadDocument(self, action_runner): | 220 def _DidLoadDocument(self, action_runner): |
221 # Close the popup window. On Nexus 9 (and probably other tables) the popup | 221 # Close the popup window. On Nexus 9 (and probably other tables) the popup |
222 # window does not have a "Close" button, instead it has only a "Send link | 222 # window does not have a "Close" button, instead it has only a "Send link |
223 # to phone" button. So on tablets we run with the popup window open. The | 223 # to phone" button. So on tablets we run with the popup window open. The |
224 # popup is transparent, so this is mostly an aesthetical issue. | 224 # popup is transparent, so this is mostly an aesthetical issue. |
225 # TODO(catapult:#3028): Fix interpolation of JavaScript values. | |
226 has_button = action_runner.EvaluateJavaScript( | 225 has_button = action_runner.EvaluateJavaScript( |
227 '!!document.querySelector("%s")' % self._CLOSE_BUTTON_SELECTOR) | 226 '!!document.querySelector({{ selector }})', |
| 227 selector=self._CLOSE_BUTTON_SELECTOR) |
228 if has_button: | 228 if has_button: |
229 action_runner.ClickElement(selector=self._CLOSE_BUTTON_SELECTOR) | 229 action_runner.ClickElement(selector=self._CLOSE_BUTTON_SELECTOR) |
230 super(WashingtonPostMobileStory, self)._DidLoadDocument(action_runner) | 230 super(WashingtonPostMobileStory, self)._DidLoadDocument(action_runner) |
231 | 231 |
232 | 232 |
233 ############################################################################## | 233 ############################################################################## |
234 # Search browsing stories. | 234 # Search browsing stories. |
235 ############################################################################## | 235 ############################################################################## |
236 | 236 |
237 | 237 |
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
468 inner_save_function = 'document.querySelector(".nameAndIcons")' | 468 inner_save_function = 'document.querySelector(".nameAndIcons")' |
469 action_runner.WaitForElement(element_function=inner_save_function) | 469 action_runner.WaitForElement(element_function=inner_save_function) |
470 action_runner.ClickElement(element_function=inner_save_function) | 470 action_runner.ClickElement(element_function=inner_save_function) |
471 action_runner.Wait(1) # Wait to make navigation realistic. | 471 action_runner.Wait(1) # Wait to make navigation realistic. |
472 | 472 |
473 # Close selection. | 473 # Close selection. |
474 x_element_function = ('document.querySelector(' | 474 x_element_function = ('document.querySelector(' |
475 '".Button.borderless.close.visible")') | 475 '".Button.borderless.close.visible")') |
476 action_runner.ClickElement(element_function=x_element_function) | 476 action_runner.ClickElement(element_function=x_element_function) |
477 action_runner.Wait(1) # Wait to make navigation realistic. | 477 action_runner.Wait(1) # Wait to make navigation realistic. |
OLD | NEW |