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

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

Issue 1827003004: [Chromedriver] Chromedriver should handle unexpected alert automatically. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: remove getter, use variable directly. Created 4 years 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 | « chrome/test/chromedriver/capabilities.cc ('k') | chrome/test/chromedriver/session.h » ('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 sys 5 import sys
6 import platform 6 import platform
7 7
8 import command_executor 8 import command_executor
9 from command_executor import Command 9 from command_executor import Command
10 from webelement import WebElement 10 from webelement import WebElement
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 """Starts and controls a single Chrome instance on this machine.""" 104 """Starts and controls a single Chrome instance on this machine."""
105 105
106 def __init__(self, server_url, chrome_binary=None, android_package=None, 106 def __init__(self, server_url, chrome_binary=None, android_package=None,
107 android_activity=None, android_process=None, 107 android_activity=None, android_process=None,
108 android_use_running_app=None, chrome_switches=None, 108 android_use_running_app=None, chrome_switches=None,
109 chrome_extensions=None, chrome_log_path=None, 109 chrome_extensions=None, chrome_log_path=None,
110 debugger_address=None, logging_prefs=None, 110 debugger_address=None, logging_prefs=None,
111 mobile_emulation=None, experimental_options=None, 111 mobile_emulation=None, experimental_options=None,
112 download_dir=None, network_connection=None, 112 download_dir=None, network_connection=None,
113 send_w3c_capability=None, send_w3c_request=None, 113 send_w3c_capability=None, send_w3c_request=None,
114 page_load_strategy=None): 114 page_load_strategy=None, unexpected_alert_behaviour=None):
115 self._executor = command_executor.CommandExecutor(server_url) 115 self._executor = command_executor.CommandExecutor(server_url)
116 116
117 options = {} 117 options = {}
118 118
119 if experimental_options: 119 if experimental_options:
120 assert isinstance(experimental_options, dict) 120 assert isinstance(experimental_options, dict)
121 options = experimental_options.copy() 121 options = experimental_options.copy()
122 122
123 if android_package: 123 if android_package:
124 options['androidPackage'] = android_package 124 options['androidPackage'] = android_package
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 'desiredCapabilities': { 183 'desiredCapabilities': {
184 'chromeOptions': options, 184 'chromeOptions': options,
185 'loggingPrefs': logging_prefs 185 'loggingPrefs': logging_prefs
186 } 186 }
187 } 187 }
188 188
189 if page_load_strategy: 189 if page_load_strategy:
190 assert type(page_load_strategy) is str 190 assert type(page_load_strategy) is str
191 params['desiredCapabilities']['pageLoadStrategy'] = page_load_strategy 191 params['desiredCapabilities']['pageLoadStrategy'] = page_load_strategy
192 192
193 if unexpected_alert_behaviour:
194 assert type(unexpected_alert_behaviour) is str
195 params['desiredCapabilities']['unexpectedAlertBehaviour'] = (
196 unexpected_alert_behaviour)
197
193 if network_connection: 198 if network_connection:
194 params['desiredCapabilities']['networkConnectionEnabled'] = ( 199 params['desiredCapabilities']['networkConnectionEnabled'] = (
195 network_connection) 200 network_connection)
196 201
197 if send_w3c_request: 202 if send_w3c_request:
198 params = {'capabilities': params} 203 params = {'capabilities': params}
199 204
200 response = self._ExecuteCommand(Command.NEW_SESSION, params) 205 response = self._ExecuteCommand(Command.NEW_SESSION, params)
201 if isinstance(response['status'], basestring): 206 if isinstance(response['status'], basestring):
202 self.w3c_compliant = True 207 self.w3c_compliant = True
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after
494 self.ExecuteCommand(Command.DELETE_SCREEN_ORIENTATION) 499 self.ExecuteCommand(Command.DELETE_SCREEN_ORIENTATION)
495 500
496 def SendKeys(self, *values): 501 def SendKeys(self, *values):
497 typing = [] 502 typing = []
498 for value in values: 503 for value in values:
499 if isinstance(value, int): 504 if isinstance(value, int):
500 value = str(value) 505 value = str(value)
501 for i in range(len(value)): 506 for i in range(len(value)):
502 typing.append(value[i]) 507 typing.append(value[i])
503 self.ExecuteCommand(Command.SEND_KEYS_TO_ACTIVE_ELEMENT, {'value': typing}) 508 self.ExecuteCommand(Command.SEND_KEYS_TO_ACTIVE_ELEMENT, {'value': typing})
OLDNEW
« no previous file with comments | « chrome/test/chromedriver/capabilities.cc ('k') | chrome/test/chromedriver/session.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698