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

Unified Diff: tools/testing/run_selenium.py

Issue 11092015: Chrome extension to get console messages upon test failures. Unlike the (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 2 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
Index: tools/testing/run_selenium.py
===================================================================
--- tools/testing/run_selenium.py (revision 13385)
+++ tools/testing/run_selenium.py (working copy)
@@ -141,15 +141,23 @@
def start_browser(browser, executable_path, html_out):
if browser == 'chrome':
+ script_dir = os.path.dirname(os.path.abspath(__file__))
+ crx = os.path.join(script_dir, 'extensions', 'chrome',
+ 'ConsoleCollector.crx')
+ options = selenium.webdriver.chrome.options.Options();
Emily Fortuna 2012/10/09 18:15:22 delete the semicolons through here
gram 2012/10/09 18:57:14 Done.
+ options.add_extension(crx);
# Note: you need ChromeDriver *in your path* to run Chrome, in addition to
# installing Chrome. Also note that the build bot runs have a different path
# from a normal user -- check the build logs.
- return selenium.webdriver.Chrome()
+ return selenium.webdriver.Chrome(chrome_options=options);
elif browser == 'dartium':
script_dir = os.path.dirname(os.path.abspath(__file__))
dartium_dir = os.path.join(script_dir, '..', '..', 'client', 'tests',
'dartium')
+ crx = os.path.join(script_dir, 'extensions', 'chrome',
+ 'ConsoleCollector.crx')
options = selenium.webdriver.chrome.options.Options()
+ options.add_extension(crx);
Emily Fortuna 2012/10/09 18:15:22 delete the semicolon...
gram 2012/10/09 18:57:14 Done.
# enable ShadowDOM and style scoped for Dartium
options.add_argument('--enable-shadow-dom')
options.add_argument('--enable-style-scoped')
@@ -170,7 +178,8 @@
profile.set_preference('dom.max_chrome_script_run_time', 0)
profile.set_preference('app.update.auto', True)
profile.set_preference('app.update.enabled', True)
- xpi = os.path.join(script_dir, 'extensions', 'firefox', 'ConsoleCollector.xpi')
+ xpi = os.path.join(script_dir, 'extensions', 'firefox',
+ 'ConsoleCollector.xpi')
profile.add_extension(xpi);
return selenium.webdriver.Firefox(firefox_profile=profile)
elif browser == 'ie' and platform.system() == 'Windows':
@@ -247,12 +256,16 @@
index += len('<body>')
end_index = source.find('</body')
print unicode(source[index : end_index]).encode("utf-8")
+ logs = []
if type(browser) is selenium.webdriver.firefox.webdriver.WebDriver:
logs = browser.execute_script("return window.ConsoleCollector.read()");
- for msg in logs:
- print('%s:%s:%s:%s %s' %(
- msg['source'], msg['line'], msg['column'],
- msg['category'], msg['message']))
+ elif type(browser) is selenium.webdriver.chrome.webdriver.WebDriver:
+ browser.set_script_timeout(2000)
+ logs = browser.execute_async_script(
+ "getMessages(arguments[arguments.length-1])");
+ for msg in logs:
+ print('%s:%s:%s %s' %(
+ msg['source'], msg['line'], msg['category'], msg['message']))
return 1

Powered by Google App Engine
This is Rietveld 408576698