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

Unified Diff: tools/telemetry/telemetry/page/actions/click_element.py

Issue 181483002: Telemetry: Clean up tap and click_element gestures. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 6 years, 9 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 | « tools/perf/page_sets/top_25.json ('k') | tools/telemetry/telemetry/page/actions/click_element_unittest.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/telemetry/telemetry/page/actions/click_element.py
diff --git a/tools/telemetry/telemetry/page/actions/click_element.py b/tools/telemetry/telemetry/page/actions/click_element.py
deleted file mode 100644
index 91339c76fd375589ade8665ef956356ac2471342..0000000000000000000000000000000000000000
--- a/tools/telemetry/telemetry/page/actions/click_element.py
+++ /dev/null
@@ -1,51 +0,0 @@
-# Copyright (c) 2012 The Chromium Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-import re
-
-from telemetry.core import util
-from telemetry.core import exceptions
-from telemetry.page.actions import page_action
-
-def _EscapeSelector(selector):
- return selector.replace('\'', '\\\'')
-
-class ClickElementAction(page_action.PageAction):
- def __init__(self, attributes=None):
- super(ClickElementAction, self).__init__(attributes)
-
- def RunAction(self, page, tab, previous_action):
- def DoClick():
- if hasattr(self, 'selector'):
- code = ('document.querySelector(\'' + _EscapeSelector(self.selector) +
- '\').click();')
- try:
- tab.ExecuteJavaScript(code)
- except exceptions.EvaluateException:
- raise page_action.PageActionFailed(
- 'Cannot find element with selector ' + self.selector)
- elif hasattr(self, 'text'):
- callback_code = 'function(element) { element.click(); }'
- try:
- util.FindElementAndPerformAction(tab, self.text, callback_code)
- except exceptions.EvaluateException:
- raise page_action.PageActionFailed(
- 'Cannot find element with text ' + self.text)
- elif hasattr(self, 'xpath'):
- code = ('document.evaluate("%s",'
- 'document,'
- 'null,'
- 'XPathResult.FIRST_ORDERED_NODE_TYPE,'
- 'null)'
- '.singleNodeValue.click()' % re.escape(self.xpath))
- try:
- tab.ExecuteJavaScript(code)
- except exceptions.EvaluateException:
- raise page_action.PageActionFailed(
- 'Cannot find element with xpath ' + self.xpath)
- else:
- raise page_action.PageActionFailed(
- 'No condition given to click_element')
-
- DoClick()
« no previous file with comments | « tools/perf/page_sets/top_25.json ('k') | tools/telemetry/telemetry/page/actions/click_element_unittest.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698