Description
When using the Shady DOM polyfill https://github.com/webcomponents/shadydom you will hit TypeError: cyclic object value
when trying to return a list of elements from an execute script call (see webcomponents/shadydom#217).
It seems that webdrivers internally use JSON.stringify
on the list of elements to return, which in turn runs JSON.stringify
on the elements inside the list. While this works fine for the standard case, the Shady DOM polyfill adds a __shady
property to the element and at least when the element contains children, the __shady
property contains cycles and cannot thus be coverted to JSON. Now this implementation detail of __shady
has seemingly absolutely nothing to do with returning an element from a webdriver but because of JSON.stringify
, it won't work.
Returning a single element works fine as JSON.stringify
does not seem to be used in that case.