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 chrome-based tests. |
5 | 5 |
6 """ | 6 """ |
7 from chrome_remote_control.browser_finder import * | 7 from chrome_remote_control.browser_finder import FindBrowser |
8 from chrome_remote_control.browser_options import * | 8 from chrome_remote_control.browser_finder import GetAllAvailableBrowserTypes |
9 from chrome_remote_control.browser import * | 9 from chrome_remote_control.browser_options import BrowserOptions |
10 from chrome_remote_control.tab import * | 10 from chrome_remote_control.browser import Browser |
11 from chrome_remote_control.util import * | 11 from chrome_remote_control.tab import Tab |
| 12 from chrome_remote_control.util import TimeoutException, WaitFor |
12 | 13 |
13 def CreateBrowser(browser_type): | 14 def CreateBrowser(browser_type): |
14 """Shorthand way to create a browser of a given type | 15 """Shorthand way to create a browser of a given type |
15 | 16 |
16 However, note that the preferred way to create a browser is: | 17 However, note that the preferred way to create a browser is: |
17 options = BrowserOptions() | 18 options = BrowserOptions() |
18 _, leftover_args, = options.CreateParser().parse_args() | 19 _, leftover_args, = options.CreateParser().parse_args() |
19 browser_to_create = FindBrowser(options) | 20 browser_to_create = FindBrowser(options) |
20 return browser_to_create.Create() | 21 return browser_to_create.Create() |
21 | 22 |
22 as it creates more opportunities for customization and | 23 as it creates more opportunities for customization and |
23 error handling.""" | 24 error handling.""" |
24 browser_to_create = FindBrowser(BrowserOptions(browser_type)) | 25 browser_to_create = FindBrowser(BrowserOptions(browser_type)) |
25 if not browser_to_create: | 26 if not browser_to_create: |
26 raise Exception('No browser of type %s found' % browser_type) | 27 raise Exception('No browser of type %s found' % browser_type) |
27 return browser_to_create.Create() | 28 return browser_to_create.Create() |
OLD | NEW |