OLD | NEW |
1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 """A library for chrome-based tests. | 4 """A library for cross-platform browser tests.""" |
5 | |
6 """ | |
7 from telemetry.browser import Browser | |
8 from telemetry.browser_finder import FindBrowser | |
9 from telemetry.browser_finder import GetAllAvailableBrowserTypes | |
10 from telemetry.browser_gone_exception import BrowserGoneException | |
11 from telemetry.browser_options import BrowserOptions | |
12 from telemetry.tab import Tab | |
13 from telemetry.tab_crash_exception import TabCrashException | |
14 from telemetry.util import TimeoutException, WaitFor | |
15 | |
16 def CreateBrowser(browser_type): | |
17 """Shorthand way to create a browser of a given type | |
18 | |
19 However, note that the preferred way to create a browser is: | |
20 options = BrowserOptions() | |
21 _, leftover_args, = options.CreateParser().parse_args() | |
22 browser_to_create = FindBrowser(options) | |
23 return browser_to_create.Create() | |
24 | |
25 as it creates more opportunities for customization and | |
26 error handling.""" | |
27 browser_to_create = FindBrowser(BrowserOptions(browser_type)) | |
28 if not browser_to_create: | |
29 raise Exception('No browser of type %s found' % browser_type) | |
30 return browser_to_create.Create() | |
OLD | NEW |