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

Side by Side Diff: tools/testing/run_selenium.py

Issue 9252002: Make changes for Safari to run with webdriver on the bots. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: '' Created 8 years, 11 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « tools/testing/perf_testing/perf_README.txt ('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/python 1 #!/usr/bin/python
2 2
3 # Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 3 # Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
4 # for details. All rights reserved. Use of this source code is governed by a 4 # for details. All rights reserved. Use of this source code is governed by a
5 # BSD-style license that can be found in the LICENSE file. 5 # BSD-style license that can be found in the LICENSE file.
6 # 6 #
7 7
8 """Script to actually open a browser and perform the test, and reports back with 8 """Script to actually open a browser and perform the test, and reports back with
9 the result. 9 the result.
10 """ 10 """
11 11
12 import os
12 import optparse 13 import optparse
13 import platform 14 import platform
14 import selenium 15 import selenium
15 from selenium.webdriver.support.ui import WebDriverWait 16 from selenium.webdriver.support.ui import WebDriverWait
17 import shutil
16 import socket 18 import socket
17 import sys 19 import sys
18 import time 20 import time
19 21
20 def perf_test_done(driver): 22 def perf_test_done(driver):
21 """Checks if the performance test has completed.""" 23 """Checks if the performance test has completed."""
22 return perf_test_done_helper(driver.page_source) 24 return perf_test_done_helper(driver.page_source)
23 25
24 def perf_test_done_helper(source): 26 def perf_test_done_helper(source):
25 """Tests to see if our performance test is done by printing a score.""" 27 """Tests to see if our performance test is done by printing a score."""
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 browser = None 103 browser = None
102 html_out, browser, timeout, is_perf = parse_args() 104 html_out, browser, timeout, is_perf = parse_args()
103 105
104 if browser == 'chrome': 106 if browser == 'chrome':
105 browser = selenium.webdriver.Chrome() 107 browser = selenium.webdriver.Chrome()
106 elif browser == 'ff': 108 elif browser == 'ff':
107 browser = selenium.webdriver.Firefox() 109 browser = selenium.webdriver.Firefox()
108 elif browser == 'ie' and platform.system() == 'Windows': 110 elif browser == 'ie' and platform.system() == 'Windows':
109 browser = selenium.webdriver.Ie() 111 browser = selenium.webdriver.Ie()
110 elif browser == 'safari' and platform.system() == 'Darwin': 112 elif browser == 'safari' and platform.system() == 'Darwin':
113 # TODO(efortuna): Ensure our preferences (no pop-up blocking) file is the
114 # same (Safari auto-deletes when it has too many "crashes," or in our case,
115 # timeouts). Come up with a less hacky way to do this.
116 shutil.copy(os.path.dirname(__file__) + '/com.apple.Safari.plist',
117 '/Library/Preferences/com.apple.Safari.plist')
111 sel = selenium.selenium('localhost', 4444, "*safari", 'file://' + html_out) 118 sel = selenium.selenium('localhost', 4444, "*safari", 'file://' + html_out)
112 try: 119 try:
113 sel.start() 120 sel.start()
114 except socket.error: 121 except socket.error:
115 print 'ERROR: Could not connect to Selenium RC server. Are you running' +\ 122 print 'ERROR: Could not connect to Selenium RC server. Are you running' +\
116 ' java -jar selenium-server-standalone-2.15.0.jar? If not, start ' + \ 123 ' java -jar selenium-server-standalone-2.15.0.jar? If not, start ' + \
117 'it before running this test.' 124 'it before running this test.'
118 return 1 125 return 1
119 else: 126 else:
120 raise Exception('Incompatible browser and platform combination.') 127 raise Exception('Incompatible browser and platform combination.')
(...skipping 21 matching lines...) Expand all
142 #TODO(efortuna): Access these elements in a nicer way using DOM parser. 149 #TODO(efortuna): Access these elements in a nicer way using DOM parser.
143 index = source.find('<body>') 150 index = source.find('<body>')
144 index += len('<body>') 151 index += len('<body>')
145 end_index = source.find('<script') 152 end_index = source.find('<script')
146 print source[index : end_index] 153 print source[index : end_index]
147 return 1 154 return 1
148 155
149 156
150 if __name__ == "__main__": 157 if __name__ == "__main__":
151 sys.exit(Main()) 158 sys.exit(Main())
OLDNEW
« no previous file with comments | « tools/testing/perf_testing/perf_README.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698