diff options
author | nirnimesh@chromium.org <nirnimesh@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-10-08 00:41:26 +0000 |
---|---|---|
committer | nirnimesh@chromium.org <nirnimesh@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-10-08 00:41:26 +0000 |
commit | f9e3c52fb5feba4c279dbbbec049aff0b45b3955 (patch) | |
tree | 05c3f9b88bc11f4da42280a8375b090b51cc691b /chrome/test/pyautolib | |
parent | 7ec5b39703cf0c000d3556e5fc2bff4cb7b9fb21 (diff) | |
download | chromium_src-f9e3c52fb5feba4c279dbbbec049aff0b45b3955.zip chromium_src-f9e3c52fb5feba4c279dbbbec049aff0b45b3955.tar.gz chromium_src-f9e3c52fb5feba4c279dbbbec049aff0b45b3955.tar.bz2 |
Automation support for Find on a given page and return the search count
(Committing on behalf of amolk. Originally reviewed and LGTM-ed at
http://codereview.chromium.org/3402021/show)
BUG=36177
TEST=find_in_page.py
Review URL: http://codereview.chromium.org/3590026
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@61898 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/test/pyautolib')
-rw-r--r-- | chrome/test/pyautolib/pyauto.py | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/chrome/test/pyautolib/pyauto.py b/chrome/test/pyautolib/pyauto.py index 3fed9f71..f51c11d 100644 --- a/chrome/test/pyautolib/pyauto.py +++ b/chrome/test/pyautolib/pyauto.py @@ -1383,6 +1383,42 @@ class PyUITest(pyautolib.PyUITestBase, unittest.TestCase): } return self._GetResultFromJSONRequest(cmd_dict) + def FindInPage(self, search_string, forward=True, + match_case=False, find_next=False, + tab_index=0, windex=0): + """Find the match count for the given search string and search parameters. + This is equivalent to using the find box + + Args: + search_string: The string to find on the page. + forward: Boolean to set if the search direction is forward or backwards + match_case: Boolean to set for case sensitive search. + find_next: Boolean to set to continue the search or start from beginning. + tab_index: The tab index, default is 0. + window_index: The window index, default is 0. + + Returns: + number of matches found for the given search string and parameters + SAMPLE: + { u'match_count': 10, + u'match_left': 100, + u'match_top': 100, + u'match_right': 200, + u'match_bottom': 200} + + Raises: + pyauto_errors.JSONInterfaceError if the automation call returns an error. + """ + cmd_dict = { + 'command': 'FindInPage', + 'tab_index' : tab_index, + 'search_string' : search_string, + 'forward' : forward, + 'match_case' : match_case, + 'find_next' : find_next, + } + return self._GetResultFromJSONRequest(cmd_dict, windex=windex) + class PyUITestSuite(pyautolib.PyUITestSuiteBase, unittest.TestSuite): """Base TestSuite for PyAuto UI tests.""" |