@@ -61,6 +61,8 @@ def jsondump(data):
61
61
_FIREFOX_EXTENSION_FNAME = 'codebender.xpi'
62
62
# Chrome extension for Chrome versions < 42.
63
63
_CHROME_EXTENSION_FNAME = 'codebendercc-extension.crx'
64
+ # Chrome extension for Chrome versions >= 42.
65
+ _CHROME_APP_FNAME = 'chrome-app-1.0.0.8.zip'
64
66
65
67
# Maximum version number that we can use the Chrome extension with.
66
68
# For versions higher than this, we need to use the newer Codebender app.
@@ -140,24 +142,16 @@ def create_webdriver(command_executor, desired_capabilities):
140
142
if browser_name == "chrome" :
141
143
desired_capabilities = DesiredCapabilities .CHROME .copy ()
142
144
desired_capabilities .update (_capabilities )
143
-
144
- # NOTE: the following logic is disabled since the remote webdriver is
145
- # not properly installing the codebender extension. It is kept for
146
- # reference until we can figure out how to properly add the Chrome
147
- # extension.
148
-
149
- # # Add chrome extension to capabilities
150
- # options = chrome.options.Options()
151
- # options.add_extension(os.path.join(_EXTENSIONS_DIR, _CHROME_EXTENSION_FNAME))
152
- # desired_capabilities.update(options.to_capabilities())
153
- # # Right now we only support up to v41 for this testing suite.
154
- # if "version" in desired_capabilities:
155
- # if desired_capabilities["version"] > CHROME_EXT_MAX_CHROME_VERSION:
156
- # raise ValueError("The testing suite only supports Chrome versions up to v%d, "
157
- # "but v%d was specified. Please specify a lower version "
158
- # "number." % (CHROME_EXT_MAX_CHROME_VERSION, desired_capabilities["version"]))
159
- # else:
160
- # desired_capabilities["version"] = CHROME_EXT_MAX_CHROME_VERSION
145
+ if desired_capabilities ["version" ] > CHROME_EXT_MAX_CHROME_VERSION :
146
+ # Add new chrome extension to capabilities.
147
+ options = chrome .options .Options ()
148
+ options .add_extension (os .path .join (_EXTENSIONS_DIR , _CHROME_APP_FNAME ))
149
+ desired_capabilities .update (options .to_capabilities ())
150
+ desired_capabilities .update (_capabilities )
151
+ else :
152
+ raise ValueError ("The testing suite only supports Chrome versions greater than v%d, "
153
+ "but v%d was specified. Please specify a higher version number."
154
+ % (CHROME_EXT_MAX_CHROME_VERSION , desired_capabilities ["version" ]))
161
155
162
156
elif browser_name == "firefox" :
163
157
desired_capabilities = DesiredCapabilities .FIREFOX .copy ()
0 commit comments