Skip to content

tab.evaluate with return_by_value=True returns RemoteObject instead of simple python object #195

@thromer

Description

@thromer

I have code that calls tab.evaluate with JavaScript that returns JSON. In zendriver-0.12.1 evaluate(..., return_by_value=True) would return a simple python object corresponding to the JSON, but in zendriver-0.14.0 I get a RemoteObject, or if return_by_value=True, a python object with values that carry type information alongside the values.

This seems to me like a dramatic change in behavior. Is it intended? I did have a look at #183 and friends and it wasn't clear to me how I should proceed.

Sample code:

print("return_by_value=True ", await tab.evaluate('(() => ({a: 1, b: "x"}))()', return_by_value=True))
print("return_by_value=False", await tab.evaluate('(() => ({a: 1, b: "x"}))()', return_by_value=False))

Output with 0.12.1

return_by_value=True  {'a': 1, 'b': 'x'}
return_by_value=False (RemoteObject(type_='object', subtype=None, class_name='Object', value=None, unserializable_value=None, description='Object', deep_serialized_value=None, object_id=RemoteObjectId('-7225819400658030577.2.1'), preview=None, custom_preview=None), None)

Output with 0.14.0

return_by_value=True  (RemoteObject(type_='object', subtype=None, class_name='Object', value=None, unserializable_value=None, description='Object', deep_serialized_value=DeepSerializedValue(type_='object', value=[['a', {'type': 'number', 'value': 1}], ['b', {'type': 'string', 'value': 'x'}]], object_id=None, weak_local_object_reference=None), object_id=RemoteObjectId('1326984328414695228.2.1'), preview=None, custom_preview=None), None)
return_by_value=False [['a', {'type': 'number', 'value': 1}], ['b', {'type': 'string', 'value': 'x'}]]

In case it matters, this is with Google Chrome 138.0.7204.183-1 on Debian bookworm.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions