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

Unified Diff: tools/perf/page_sets/system_health/browsing_stories.py

Issue 2171713003: [system health] Make mobile washington post story more robust. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: whitespace Created 4 years, 5 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
Index: tools/perf/page_sets/system_health/browsing_stories.py
diff --git a/tools/perf/page_sets/system_health/browsing_stories.py b/tools/perf/page_sets/system_health/browsing_stories.py
index 45c5dde75e190865205c131ef6431213f7f7ae8b..34ebc2e16a752e5c06f5ce87b2c6ccef65990ccb 100644
--- a/tools/perf/page_sets/system_health/browsing_stories.py
+++ b/tools/perf/page_sets/system_health/browsing_stories.py
@@ -198,14 +198,20 @@ class WashingtonPostMobileStory(_NewsBrowsingStory):
ITEM_SELECTOR = '.hed > a'
SUPPORTED_PLATFORMS = platforms.MOBILE_ONLY
_CLOSE_BUTTON_SELECTOR = '.close'
+ _MAIL_BUTTON_SELECTOR = '.mailBlock'
def _DidLoadDocument(self, action_runner):
# Close the popup window. On Nexus 9 (and probably other tables) the popup
# window does not have a "Close" button, instead it has only a "Send link
# to phone" button. So on tablets we run with the popup window open. The
# popup is transparent, so this is mostly an aesthetical issue.
- has_button = action_runner.EvaluateJavaScript(
+ action_runner.WaitForElement(selector="%s, %s" %
+ (self._CLOSE_BUTTON_SELECTOR, self._MAIL_BUTTON_SELECTOR))
+ has_close_button = action_runner.EvaluateJavaScript(
'!!document.querySelector("%s")' % self._CLOSE_BUTTON_SELECTOR)
- if has_button:
+ if has_close_button:
action_runner.ClickElement(selector=self._CLOSE_BUTTON_SELECTOR)
+ else:
petrcermak 2016/07/21 09:49:13 Given that you have waited for the element, I don'
ulan 2016/07/21 09:53:24 Done.
+ assert action_runner.EvaluateJavaScript(
+ '!!document.querySelector("%s")' % self._MAIL_BUTTON_SELECTOR)
super(WashingtonPostMobileStory, self)._DidLoadDocument(action_runner)

Powered by Google App Engine
This is Rietveld 408576698