Index: chrome/test/chromedriver/client/chromedriver.py |
diff --git a/chrome/test/chromedriver/client/chromedriver.py b/chrome/test/chromedriver/client/chromedriver.py |
index f211bb4589a95da7dca7a453928cb6abe6b007f2..f3d6880d94254819043fc4cbe16b28b78a1e461b 100644 |
--- a/chrome/test/chromedriver/client/chromedriver.py |
+++ b/chrome/test/chromedriver/client/chromedriver.py |
@@ -9,6 +9,8 @@ import command_executor |
from command_executor import Command |
from webelement import WebElement |
+ELEMENT_KEY_W3C = "element-6066-11e4-a52e-4f735466cecf" |
+ELEMENT_KEY = "ELEMENT" |
class ChromeDriverException(Exception): |
pass |
@@ -208,6 +210,7 @@ class ChromeDriver(object): |
self._session_id = response['sessionId'] |
self.capabilities = self._UnwrapValue(response['value']) |
+ |
def _WrapValue(self, value): |
"""Wrap value from client side for chromedriver side.""" |
if isinstance(value, dict): |
@@ -216,18 +219,25 @@ class ChromeDriver(object): |
converted[key] = self._WrapValue(val) |
return converted |
elif isinstance(value, WebElement): |
- return {'ELEMENT': value._id} |
+ if (self.w3c_compliant): |
+ return {ELEMENT_KEY_W3C: value._id} |
+ else: |
+ return {ELEMENT_KEY: value._id} |
elif isinstance(value, list): |
return list(self._WrapValue(item) for item in value) |
else: |
return value |
def _UnwrapValue(self, value): |
- """Unwrap value from chromedriver side for client side.""" |
if isinstance(value, dict): |
- if (len(value) == 1 and 'ELEMENT' in value |
- and isinstance(value['ELEMENT'], basestring)): |
- return WebElement(self, value['ELEMENT']) |
+ if (self.w3c_compliant and len(value) == 1 |
+ and ELEMENT_KEY_W3C in value |
+ and isinstance( |
+ value[ELEMENT_KEY_W3C], basestring)): |
+ return WebElement(self, value[ELEMENT_KEY_W3C]) |
+ elif (len(value) == 1 and ELEMENT_KEY in value |
+ and isinstance(value[ELEMENT_KEY], basestring)): |
+ return WebElement(self, value[ELEMENT_KEY]) |
else: |
unwraped = {} |
for key, val in value.items(): |