| OLD | NEW |
| 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 sys | 6 import sys |
| 6 import platform | 7 import util |
| 7 | 8 |
| 8 import command_executor | 9 import command_executor |
| 9 from command_executor import Command | 10 from command_executor import Command |
| 10 from webelement import WebElement | 11 from webelement import WebElement |
| 11 | 12 |
| 12 ELEMENT_KEY_W3C = "element-6066-11e4-a52e-4f735466cecf" | 13 ELEMENT_KEY_W3C = "element-6066-11e4-a52e-4f735466cecf" |
| 13 ELEMENT_KEY = "ELEMENT" | 14 ELEMENT_KEY = "ELEMENT" |
| 14 | 15 |
| 15 class ChromeDriverException(Exception): | 16 class ChromeDriverException(Exception): |
| 16 pass | 17 pass |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 options['androidPackage'] = android_package | 127 options['androidPackage'] = android_package |
| 127 if android_activity: | 128 if android_activity: |
| 128 options['androidActivity'] = android_activity | 129 options['androidActivity'] = android_activity |
| 129 if android_process: | 130 if android_process: |
| 130 options['androidProcess'] = android_process | 131 options['androidProcess'] = android_process |
| 131 if android_use_running_app: | 132 if android_use_running_app: |
| 132 options['androidUseRunningApp'] = android_use_running_app | 133 options['androidUseRunningApp'] = android_use_running_app |
| 133 elif chrome_binary: | 134 elif chrome_binary: |
| 134 options['binary'] = chrome_binary | 135 options['binary'] = chrome_binary |
| 135 | 136 |
| 136 # TODO(samuong): speculative fix for crbug.com/611886 | 137 if sys.platform.startswith('linux') and not util.Is64Bit(): |
| 137 if (sys.platform.startswith('linux') and | |
| 138 platform.architecture()[0] == '32bit'): | |
| 139 if chrome_switches is None: | 138 if chrome_switches is None: |
| 140 chrome_switches = [] | 139 chrome_switches = [] |
| 140 # Workaround for crbug.com/611886. |
| 141 chrome_switches.append('no-sandbox') | 141 chrome_switches.append('no-sandbox') |
| 142 # https://bugs.chromium.org/p/chromedriver/issues/detail?id=1695 |
| 143 chrome_switches.append('disable-gpu') |
| 142 | 144 |
| 143 if chrome_switches: | 145 if chrome_switches: |
| 144 assert type(chrome_switches) is list | 146 assert type(chrome_switches) is list |
| 145 options['args'] = chrome_switches | 147 options['args'] = chrome_switches |
| 146 | 148 |
| 147 if mobile_emulation: | 149 if mobile_emulation: |
| 148 assert type(mobile_emulation) is dict | 150 assert type(mobile_emulation) is dict |
| 149 options['mobileEmulation'] = mobile_emulation | 151 options['mobileEmulation'] = mobile_emulation |
| 150 | 152 |
| 151 if chrome_extensions: | 153 if chrome_extensions: |
| (...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 509 self.ExecuteCommand(Command.DELETE_SCREEN_ORIENTATION) | 511 self.ExecuteCommand(Command.DELETE_SCREEN_ORIENTATION) |
| 510 | 512 |
| 511 def SendKeys(self, *values): | 513 def SendKeys(self, *values): |
| 512 typing = [] | 514 typing = [] |
| 513 for value in values: | 515 for value in values: |
| 514 if isinstance(value, int): | 516 if isinstance(value, int): |
| 515 value = str(value) | 517 value = str(value) |
| 516 for i in range(len(value)): | 518 for i in range(len(value)): |
| 517 typing.append(value[i]) | 519 typing.append(value[i]) |
| 518 self.ExecuteCommand(Command.SEND_KEYS_TO_ACTIVE_ELEMENT, {'value': typing}) | 520 self.ExecuteCommand(Command.SEND_KEYS_TO_ACTIVE_ELEMENT, {'value': typing}) |
| OLD | NEW |