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

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
« functional/find_in_page.py ('K') | « 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 2639 matching lines...) Expand 10 before | Expand all | Expand 10 after
2650 pyauto_errors.JSONInterfaceError if the automation call returns an error. 2650 pyauto_errors.JSONInterfaceError if the automation call returns an error.
2651 """ 2651 """
2652 cmd_dict = { 2652 cmd_dict = {
2653 'command': 'WaitForNotificationCount', 2653 'command': 'WaitForNotificationCount',
2654 'count': count, 2654 'count': count,
2655 } 2655 }
2656 self._GetResultFromJSONRequest(cmd_dict) 2656 self._GetResultFromJSONRequest(cmd_dict)
2657 2657
2658 def FindInPage(self, search_string, forward=True, 2658 def FindInPage(self, search_string, forward=True,
2659 match_case=False, find_next=False, 2659 match_case=False, find_next=False,
2660 tab_index=0, windex=0): 2660 tab_index=0, windex=0, timeout=-1):
kkania 2011/12/15 00:41:36 It's too bad ActionTimeoutChanger can't be used fo
Nirnimesh 2011/12/15 05:22:04 I wasn't aware ActionTimeoutChanger is broken. I'm
2661 """Find the match count for the given search string and search parameters. 2661 """Find the match count for the given search string and search parameters.
2662 This is equivalent to using the find box. 2662 This is equivalent to using the find box.
2663 2663
2664 Args: 2664 Args:
2665 search_string: The string to find on the page. 2665 search_string: The string to find on the page.
2666 forward: Boolean to set if the search direction is forward or backwards 2666 forward: Boolean to set if the search direction is forward or backwards
2667 match_case: Boolean to set for case sensitive search. 2667 match_case: Boolean to set for case sensitive search.
2668 find_next: Boolean to set to continue the search or start from beginning. 2668 find_next: Boolean to set to continue the search or start from beginning.
2669 tab_index: The tab index, default is 0. 2669 tab_index: The tab index, default is 0.
2670 window_index: The window index, default is 0. 2670 window_index: The window index, default is 0.
kkania 2011/12/15 00:41:36 add timeout here
vclarke1 2011/12/15 00:52:09 Done.
2671 2671
2672 Returns: 2672 Returns:
2673 number of matches found for the given search string and parameters 2673 number of matches found for the given search string and parameters
2674 SAMPLE: 2674 SAMPLE:
2675 { u'match_count': 10, 2675 { u'match_count': 10,
2676 u'match_left': 100, 2676 u'match_left': 100,
2677 u'match_top': 100, 2677 u'match_top': 100,
2678 u'match_right': 200, 2678 u'match_right': 200,
2679 u'match_bottom': 200} 2679 u'match_bottom': 200}
2680 2680
2681 Raises: 2681 Raises:
2682 pyauto_errors.JSONInterfaceError if the automation call returns an error. 2682 pyauto_errors.JSONInterfaceError if the automation call returns an error.
2683 """ 2683 """
2684 cmd_dict = { 2684 cmd_dict = {
2685 'command': 'FindInPage', 2685 'command': 'FindInPage',
2686 'tab_index' : tab_index, 2686 'tab_index' : tab_index,
2687 'search_string' : search_string, 2687 'search_string' : search_string,
2688 'forward' : forward, 2688 'forward' : forward,
2689 'match_case' : match_case, 2689 'match_case' : match_case,
2690 'find_next' : find_next, 2690 'find_next' : find_next,
2691 } 2691 }
2692 return self._GetResultFromJSONRequest(cmd_dict, windex=windex) 2692 return self._GetResultFromJSONRequest(cmd_dict, windex=windex,
2693 timeout=timeout)
2693 2694
2694 def ExecuteJavascript(self, js, tab_index=0, windex=0, frame_xpath=''): 2695 def ExecuteJavascript(self, js, tab_index=0, windex=0, frame_xpath=''):
2695 """Executes a script in the specified frame of a tab. 2696 """Executes a script in the specified frame of a tab.
2696 2697
2697 By default, execute the script in the top frame of the first tab in the 2698 By default, execute the script in the top frame of the first tab in the
2698 first window. The invoked javascript function must send a result back via 2699 first window. The invoked javascript function must send a result back via
2699 the domAutomationController.send function, or this function will never 2700 the domAutomationController.send function, or this function will never
2700 return. 2701 return.
2701 2702
2702 Args: 2703 Args:
(...skipping 2140 matching lines...) Expand 10 before | Expand all | Expand 10 after
4843 successful = result.wasSuccessful() 4844 successful = result.wasSuccessful()
4844 if not successful: 4845 if not successful:
4845 pyauto_tests_file = os.path.join(self.TestsDir(), self._tests_filename) 4846 pyauto_tests_file = os.path.join(self.TestsDir(), self._tests_filename)
4846 print >>sys.stderr, 'Tests can be disabled by editing %s. ' \ 4847 print >>sys.stderr, 'Tests can be disabled by editing %s. ' \
4847 'Ref: %s' % (pyauto_tests_file, _PYAUTO_DOC_URL) 4848 'Ref: %s' % (pyauto_tests_file, _PYAUTO_DOC_URL)
4848 sys.exit(not successful) 4849 sys.exit(not successful)
4849 4850
4850 4851
4851 if __name__ == '__main__': 4852 if __name__ == '__main__':
4852 Main() 4853 Main()
OLDNEW
« functional/find_in_page.py ('K') | « functional/find_in_page.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698