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

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

Issue 2776313003: Update ChromeDriver to accept W3C format InitSession (Closed)
Patch Set: Update exception type, code formatting, and comments Created 3 years, 8 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
« no previous file with comments | « no previous file | chrome/test/chromedriver/session_commands.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 platform 5 import platform
6 import sys 6 import sys
7 import util 7 import util
8 8
9 import command_executor 9 import command_executor
10 from command_executor import Command 10 from command_executor import Command
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 if 'prefs' not in options: 177 if 'prefs' not in options:
178 options['prefs'] = {} 178 options['prefs'] = {}
179 if 'download' not in options['prefs']: 179 if 'download' not in options['prefs']:
180 options['prefs']['download'] = {} 180 options['prefs']['download'] = {}
181 options['prefs']['download']['default_directory'] = download_dir 181 options['prefs']['download']['default_directory'] = download_dir
182 182
183 if send_w3c_capability: 183 if send_w3c_capability:
184 options['w3c'] = send_w3c_capability 184 options['w3c'] = send_w3c_capability
185 185
186 params = { 186 params = {
187 'desiredCapabilities': {
188 'chromeOptions': options, 187 'chromeOptions': options,
189 'loggingPrefs': logging_prefs 188 'loggingPrefs': logging_prefs
190 }
191 } 189 }
192 190
193 if page_load_strategy: 191 if page_load_strategy:
194 assert type(page_load_strategy) is str 192 assert type(page_load_strategy) is str
195 params['desiredCapabilities']['pageLoadStrategy'] = page_load_strategy 193 params['pageLoadStrategy'] = page_load_strategy
196 194
197 if unexpected_alert_behaviour: 195 if unexpected_alert_behaviour:
198 assert type(unexpected_alert_behaviour) is str 196 assert type(unexpected_alert_behaviour) is str
199 params['desiredCapabilities']['unexpectedAlertBehaviour'] = ( 197 params['unexpectedAlertBehaviour'] = unexpected_alert_behaviour
200 unexpected_alert_behaviour)
201 198
202 if network_connection: 199 if network_connection:
203 params['desiredCapabilities']['networkConnectionEnabled'] = ( 200 params['networkConnectionEnabled'] = network_connection
204 network_connection)
205 201
206 if send_w3c_request: 202 if send_w3c_request:
207 params = {'capabilities': params} 203 params = {'capabilities': {'alwaysMatch': params}}
204 else:
205 params = {'desiredCapabilities': params}
208 206
209 response = self._ExecuteCommand(Command.NEW_SESSION, params) 207 response = self._ExecuteCommand(Command.NEW_SESSION, params)
210 if isinstance(response['status'], basestring): 208 if isinstance(response['status'], basestring):
211 self.w3c_compliant = True 209 self.w3c_compliant = True
212 elif isinstance(response['status'], int): 210 elif isinstance(response['status'], int):
213 self.w3c_compliant = False 211 self.w3c_compliant = False
214 else: 212 else:
215 raise UnknownError("unexpected response") 213 raise UnknownError("unexpected response")
216 214
217 self._session_id = response['sessionId'] 215 self._session_id = response['sessionId']
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after
511 self.ExecuteCommand(Command.DELETE_SCREEN_ORIENTATION) 509 self.ExecuteCommand(Command.DELETE_SCREEN_ORIENTATION)
512 510
513 def SendKeys(self, *values): 511 def SendKeys(self, *values):
514 typing = [] 512 typing = []
515 for value in values: 513 for value in values:
516 if isinstance(value, int): 514 if isinstance(value, int):
517 value = str(value) 515 value = str(value)
518 for i in range(len(value)): 516 for i in range(len(value)):
519 typing.append(value[i]) 517 typing.append(value[i])
520 self.ExecuteCommand(Command.SEND_KEYS_TO_ACTIVE_ELEMENT, {'value': typing}) 518 self.ExecuteCommand(Command.SEND_KEYS_TO_ACTIVE_ELEMENT, {'value': typing})
OLDNEW
« no previous file with comments | « no previous file | chrome/test/chromedriver/session_commands.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698