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

Side by Side Diff: pyautolib/pyauto.py

Issue 8913012: Fix flakiness and re-enable http search in find_in_page.FindMatchTests.testSearchInPDF (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/chrome/test/
Patch Set: '' Created 9 years 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « functional/find_in_page.py ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright (c) 2011 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2011 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 """PyAuto: Python Interface to Chromium's Automation Proxy. 6 """PyAuto: Python Interface to Chromium's Automation Proxy.
7 7
8 PyAuto uses swig to expose Automation Proxy interfaces to Python. 8 PyAuto uses swig to expose Automation Proxy interfaces to Python.
9 For complete documentation on the functionality available, 9 For complete documentation on the functionality available,
10 run pydoc on this file. 10 run pydoc on this file.
(...skipping 2645 matching lines...) Expand 10 before | Expand all | Expand 10 after
2656 pyauto_errors.JSONInterfaceError if the automation call returns an error. 2656 pyauto_errors.JSONInterfaceError if the automation call returns an error.
2657 """ 2657 """
2658 cmd_dict = { 2658 cmd_dict = {
2659 'command': 'WaitForNotificationCount', 2659 'command': 'WaitForNotificationCount',
2660 'count': count, 2660 'count': count,
2661 } 2661 }
2662 self._GetResultFromJSONRequest(cmd_dict) 2662 self._GetResultFromJSONRequest(cmd_dict)
2663 2663
2664 def FindInPage(self, search_string, forward=True, 2664 def FindInPage(self, search_string, forward=True,
2665 match_case=False, find_next=False, 2665 match_case=False, find_next=False,
2666 tab_index=0, windex=0): 2666 tab_index=0, windex=0, timeout=-1):
2667 """Find the match count for the given search string and search parameters. 2667 """Find the match count for the given search string and search parameters.
2668 This is equivalent to using the find box. 2668 This is equivalent to using the find box.
2669 2669
2670 Args: 2670 Args:
2671 search_string: The string to find on the page. 2671 search_string: The string to find on the page.
2672 forward: Boolean to set if the search direction is forward or backwards 2672 forward: Boolean to set if the search direction is forward or backwards
2673 match_case: Boolean to set for case sensitive search. 2673 match_case: Boolean to set for case sensitive search.
2674 find_next: Boolean to set to continue the search or start from beginning. 2674 find_next: Boolean to set to continue the search or start from beginning.
2675 tab_index: The tab index, default is 0. 2675 tab_index: The tab index, default is 0.
2676 window_index: The window index, default is 0. 2676 windex: The window index, default is 0.
2677 timeout: request timeout (in milliseconds), default is -1.
2677 2678
2678 Returns: 2679 Returns:
2679 number of matches found for the given search string and parameters 2680 number of matches found for the given search string and parameters
2680 SAMPLE: 2681 SAMPLE:
2681 { u'match_count': 10, 2682 { u'match_count': 10,
2682 u'match_left': 100, 2683 u'match_left': 100,
2683 u'match_top': 100, 2684 u'match_top': 100,
2684 u'match_right': 200, 2685 u'match_right': 200,
2685 u'match_bottom': 200} 2686 u'match_bottom': 200}
2686 2687
2687 Raises: 2688 Raises:
2688 pyauto_errors.JSONInterfaceError if the automation call returns an error. 2689 pyauto_errors.JSONInterfaceError if the automation call returns an error.
2689 """ 2690 """
2690 cmd_dict = { 2691 cmd_dict = {
2691 'command': 'FindInPage', 2692 'command': 'FindInPage',
2692 'tab_index' : tab_index, 2693 'tab_index' : tab_index,
2693 'search_string' : search_string, 2694 'search_string' : search_string,
2694 'forward' : forward, 2695 'forward' : forward,
2695 'match_case' : match_case, 2696 'match_case' : match_case,
2696 'find_next' : find_next, 2697 'find_next' : find_next,
2697 } 2698 }
2698 return self._GetResultFromJSONRequest(cmd_dict, windex=windex) 2699 return self._GetResultFromJSONRequest(cmd_dict, windex=windex,
2700 timeout=timeout)
2699 2701
2700 def ExecuteJavascript(self, js, tab_index=0, windex=0, frame_xpath=''): 2702 def ExecuteJavascript(self, js, tab_index=0, windex=0, frame_xpath=''):
2701 """Executes a script in the specified frame of a tab. 2703 """Executes a script in the specified frame of a tab.
2702 2704
2703 By default, execute the script in the top frame of the first tab in the 2705 By default, execute the script in the top frame of the first tab in the
2704 first window. The invoked javascript function must send a result back via 2706 first window. The invoked javascript function must send a result back via
2705 the domAutomationController.send function, or this function will never 2707 the domAutomationController.send function, or this function will never
2706 return. 2708 return.
2707 2709
2708 Args: 2710 Args:
(...skipping 2140 matching lines...) Expand 10 before | Expand all | Expand 10 after
4849 successful = result.wasSuccessful() 4851 successful = result.wasSuccessful()
4850 if not successful: 4852 if not successful:
4851 pyauto_tests_file = os.path.join(self.TestsDir(), self._tests_filename) 4853 pyauto_tests_file = os.path.join(self.TestsDir(), self._tests_filename)
4852 print >>sys.stderr, 'Tests can be disabled by editing %s. ' \ 4854 print >>sys.stderr, 'Tests can be disabled by editing %s. ' \
4853 'Ref: %s' % (pyauto_tests_file, _PYAUTO_DOC_URL) 4855 'Ref: %s' % (pyauto_tests_file, _PYAUTO_DOC_URL)
4854 sys.exit(not successful) 4856 sys.exit(not successful)
4855 4857
4856 4858
4857 if __name__ == '__main__': 4859 if __name__ == '__main__':
4858 Main() 4860 Main()
OLDNEW
« no previous file with comments | « functional/find_in_page.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698