This is happening because the \WebDriver\Element class object isn't converted to a JSON interpretation. The only methods, that do serialization are \WebDriver\Session::execute and \WebDriver\Session::execute_async.
P.S.
I've checked other places in the code and this is the only one, where proper serialization is missing.
According to the https://www.selenium.dev/documentation/legacy/json_wire_protocol/#sessionsessionidframe it is possible to specify a JSON reference to a WebElement for frame identification.
When attempting to do so using this code I'm getting an exception from the
\WebDriver\AbstractWebDriver::assertSerializable
method:This is happening because the
\WebDriver\Element
class object isn't converted to a JSON interpretation. The only methods, that do serialization are\WebDriver\Session::execute
and\WebDriver\Session::execute_async
.P.S. I've checked other places in the code and this is the only one, where proper serialization is missing.