File tree Expand file tree Collapse file tree 2 files changed +30
-1
lines changed Expand file tree Collapse file tree 2 files changed +30
-1
lines changed Original file line number Diff line number Diff line change @@ -59,8 +59,14 @@ def get_attribute(self, name):
59
59
if attributeValue is None :
60
60
return None
61
61
62
+ if isinstance (attributeValue , dict ):
63
+ return attributeValue
64
+
62
65
if not isinstance (attributeValue , str ):
63
- attributeValue = unicode (attributeValue )
66
+ try :
67
+ attributeValue = unicode (attributeValue )
68
+ except NameError :
69
+ attributeValue = str (attributeValue )
64
70
65
71
if name != 'value' and attributeValue .lower () in ('true' , 'false' ):
66
72
return attributeValue .lower ()
Original file line number Diff line number Diff line change @@ -75,3 +75,26 @@ def test_send_key_with_file(self):
75
75
76
76
d = get_httpretty_request_body (httpretty .last_request ())
77
77
assert d ['text' ] == '' .join (d ['value' ])
78
+
79
+ @httpretty .activate
80
+ def test_get_attribute_with_dict (self ):
81
+ driver = android_w3c_driver ()
82
+ rect_dict = {
83
+ 'y' : 200 ,
84
+ 'x' : 100 ,
85
+ 'width' : 300 ,
86
+ 'height' : 56
87
+ }
88
+ httpretty .register_uri (
89
+ httpretty .GET ,
90
+ appium_command ('/session/1234567890/element/element_id/attribute/rect' ),
91
+ body = json .dumps ({"value" : rect_dict })
92
+ )
93
+
94
+ element = MobileWebElement (driver , 'element_id' , w3c = True )
95
+ ef = element .get_attribute ('rect' )
96
+
97
+ d = httpretty .last_request ()
98
+
99
+ assert isinstance (ef , dict )
100
+ assert ef == rect_dict
You can’t perform that action at this time.
0 commit comments