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

Side by Side Diff: chrome/test/chromedriver/client/chromedriver.py

Issue 23643005: [chromedriver] Load the automation extension as a component extension. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 7 years, 3 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
OLDNEW
1 # Copyright 2013 The Chromium Authors. All rights reserved. 1 # Copyright 2013 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 4
5 import command_executor 5 import command_executor
6 from command_executor import Command 6 from command_executor import Command
7 from webelement import WebElement 7 from webelement import WebElement
8 8
9 9
10 class ChromeDriverException(Exception): 10 class ChromeDriverException(Exception):
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 status = response['status'] 55 status = response['status']
56 msg = response['value']['message'] 56 msg = response['value']['message']
57 return exception_class_map.get(status, ChromeDriverException)(msg) 57 return exception_class_map.get(status, ChromeDriverException)(msg)
58 58
59 59
60 class ChromeDriver(object): 60 class ChromeDriver(object):
61 """Starts and controls a single Chrome instance on this machine.""" 61 """Starts and controls a single Chrome instance on this machine."""
62 62
63 def __init__(self, server_url, chrome_binary=None, android_package=None, 63 def __init__(self, server_url, chrome_binary=None, android_package=None,
64 chrome_switches=None, chrome_extensions=None, 64 chrome_switches=None, chrome_extensions=None,
65 chrome_log_path=None, chrome_existing_browser=None): 65 chrome_log_path=None, debugger_address=None):
66 self._executor = command_executor.CommandExecutor(server_url) 66 self._executor = command_executor.CommandExecutor(server_url)
67 67
68 options = {} 68 options = {}
69 if android_package: 69 if android_package:
70 options['androidPackage'] = android_package 70 options['androidPackage'] = android_package
71 elif chrome_binary: 71 elif chrome_binary:
72 options['binary'] = chrome_binary 72 options['binary'] = chrome_binary
73 73
74 if chrome_switches: 74 if chrome_switches:
75 assert type(chrome_switches) is list 75 assert type(chrome_switches) is list
76 options['args'] = chrome_switches 76 options['args'] = chrome_switches
77 77
78 if chrome_extensions: 78 if chrome_extensions:
79 assert type(chrome_extensions) is list 79 assert type(chrome_extensions) is list
80 options['extensions'] = chrome_extensions 80 options['extensions'] = chrome_extensions
81 81
82 if chrome_log_path: 82 if chrome_log_path:
83 assert type(chrome_log_path) is str 83 assert type(chrome_log_path) is str
84 options['logPath'] = chrome_log_path 84 options['logPath'] = chrome_log_path
85 85
86 if chrome_existing_browser: 86 if debugger_address:
87 assert type(chrome_existing_browser) is str 87 assert type(debugger_address) is str
88 options['useExistingBrowser'] = chrome_existing_browser 88 options['debuggerAddress'] = debugger_address
89 89
90 params = { 90 params = {
91 'desiredCapabilities': { 91 'desiredCapabilities': {
92 'chromeOptions': options 92 'chromeOptions': options
93 } 93 }
94 } 94 }
95 95
96 self._session_id = self._ExecuteCommand( 96 self._session_id = self._ExecuteCommand(
97 Command.NEW_SESSION, params)['sessionId'] 97 Command.NEW_SESSION, params)['sessionId']
98 98
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
282 self.ExecuteCommand( 282 self.ExecuteCommand(
283 Command.SET_WINDOW_SIZE, 283 Command.SET_WINDOW_SIZE,
284 {'windowHandle': 'current', 'width': width, 'height': height}) 284 {'windowHandle': 'current', 'width': width, 'height': height})
285 285
286 def MaximizeWindow(self): 286 def MaximizeWindow(self):
287 self.ExecuteCommand(Command.MAXIMIZE_WINDOW, {'windowHandle': 'current'}) 287 self.ExecuteCommand(Command.MAXIMIZE_WINDOW, {'windowHandle': 'current'})
288 288
289 def Quit(self): 289 def Quit(self):
290 """Quits the browser and ends the session.""" 290 """Quits the browser and ends the session."""
291 self.ExecuteCommand(Command.QUIT) 291 self.ExecuteCommand(Command.QUIT)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698