| 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 story_tags | 7 from page_sets.system_health import story_tags |
| 8 from page_sets.system_health import system_health_story | 8 from page_sets.system_health import system_health_story |
| 9 | 9 |
| 10 from page_sets.login_helpers import pinterest_login | 10 from page_sets.login_helpers import pinterest_login |
| (...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 222 IS_SINGLE_PAGE_APP = True | 222 IS_SINGLE_PAGE_APP = True |
| 223 ITEM_SELECTOR = '.hed > a' | 223 ITEM_SELECTOR = '.hed > a' |
| 224 SUPPORTED_PLATFORMS = platforms.MOBILE_ONLY | 224 SUPPORTED_PLATFORMS = platforms.MOBILE_ONLY |
| 225 _CLOSE_BUTTON_SELECTOR = '.close' | 225 _CLOSE_BUTTON_SELECTOR = '.close' |
| 226 | 226 |
| 227 def _DidLoadDocument(self, action_runner): | 227 def _DidLoadDocument(self, action_runner): |
| 228 # Close the popup window. On Nexus 9 (and probably other tables) the popup | 228 # Close the popup window. On Nexus 9 (and probably other tables) the popup |
| 229 # window does not have a "Close" button, instead it has only a "Send link | 229 # window does not have a "Close" button, instead it has only a "Send link |
| 230 # to phone" button. So on tablets we run with the popup window open. The | 230 # to phone" button. So on tablets we run with the popup window open. The |
| 231 # popup is transparent, so this is mostly an aesthetical issue. | 231 # popup is transparent, so this is mostly an aesthetical issue. |
| 232 has_button = action_runner.EvaluateJavaScript2( | 232 has_button = action_runner.EvaluateJavaScript( |
| 233 '!!document.querySelector({{ selector }})', | 233 '!!document.querySelector({{ selector }})', |
| 234 selector=self._CLOSE_BUTTON_SELECTOR) | 234 selector=self._CLOSE_BUTTON_SELECTOR) |
| 235 if has_button: | 235 if has_button: |
| 236 action_runner.ClickElement(selector=self._CLOSE_BUTTON_SELECTOR) | 236 action_runner.ClickElement(selector=self._CLOSE_BUTTON_SELECTOR) |
| 237 super(WashingtonPostMobileStory, self)._DidLoadDocument(action_runner) | 237 super(WashingtonPostMobileStory, self)._DidLoadDocument(action_runner) |
| 238 | 238 |
| 239 | 239 |
| 240 ############################################################################## | 240 ############################################################################## |
| 241 # Search browsing stories. | 241 # Search browsing stories. |
| 242 ############################################################################## | 242 ############################################################################## |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 317 def _DidLoadDocument(self, action_runner): | 317 def _DidLoadDocument(self, action_runner): |
| 318 action_runner.Wait(2) | 318 action_runner.Wait(2) |
| 319 action_runner.ScrollPage() | 319 action_runner.ScrollPage() |
| 320 action_runner.Wait(2) | 320 action_runner.Wait(2) |
| 321 | 321 |
| 322 action_runner.ScrollPage(direction='up') | 322 action_runner.ScrollPage(direction='up') |
| 323 | 323 |
| 324 # Refine search query in the search box. | 324 # Refine search query in the search box. |
| 325 # TODO(nednguyen): replace this with input text gesture to make it more | 325 # TODO(nednguyen): replace this with input text gesture to make it more |
| 326 # realistic. | 326 # realistic. |
| 327 action_runner.ExecuteJavaScript2( | 327 action_runner.ExecuteJavaScript( |
| 328 js_template.Render( | 328 js_template.Render( |
| 329 'document.querySelector({{ selector }}).value += "वितरण";', | 329 'document.querySelector({{ selector }}).value += "वितरण";', |
| 330 selector=self._SEARCH_BOX_SELECTOR)) | 330 selector=self._SEARCH_BOX_SELECTOR)) |
| 331 action_runner.Wait(2) | 331 action_runner.Wait(2) |
| 332 action_runner.ClickElement(selector=self._SEARCH_BUTTON_SELECTOR) | 332 action_runner.ClickElement(selector=self._SEARCH_BUTTON_SELECTOR) |
| 333 | 333 |
| 334 # Scroll down & click next search result page. | 334 # Scroll down & click next search result page. |
| 335 action_runner.Wait(2) | 335 action_runner.Wait(2) |
| 336 action_runner.ScrollPageToElement(selector=self._SEARCH_PAGE_2_SELECTOR) | 336 action_runner.ScrollPageToElement(selector=self._SEARCH_PAGE_2_SELECTOR) |
| 337 action_runner.Wait(2) | 337 action_runner.Wait(2) |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 479 inner_save_function = 'document.querySelector(".nameAndIcons")' | 479 inner_save_function = 'document.querySelector(".nameAndIcons")' |
| 480 action_runner.WaitForElement(element_function=inner_save_function) | 480 action_runner.WaitForElement(element_function=inner_save_function) |
| 481 action_runner.ClickElement(element_function=inner_save_function) | 481 action_runner.ClickElement(element_function=inner_save_function) |
| 482 action_runner.Wait(1) # Wait to make navigation realistic. | 482 action_runner.Wait(1) # Wait to make navigation realistic. |
| 483 | 483 |
| 484 # Close selection. | 484 # Close selection. |
| 485 x_element_function = ('document.querySelector(' | 485 x_element_function = ('document.querySelector(' |
| 486 '".Button.borderless.close.visible")') | 486 '".Button.borderless.close.visible")') |
| 487 action_runner.ClickElement(element_function=x_element_function) | 487 action_runner.ClickElement(element_function=x_element_function) |
| 488 action_runner.Wait(1) # Wait to make navigation realistic. | 488 action_runner.Wait(1) # Wait to make navigation realistic. |
| OLD | NEW |