instaclick / php-webdriver

W3C and Selenium 2 webdriver "thin client" for php 5.3+ and namespaces.
Other
436 stars 62 forks source link

The "\WebDriver\Session::frame" isn't serializing arguments #131

Closed aik099 closed 6 months ago

aik099 commented 6 months ago

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:

$webElement = $webDriver->element('id', 'my_frame_id');
$webDriver->frame(array('id' => $webElement));

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.

aik099 commented 6 months ago

PR for 1.x branch added:

As for the master I have no idea how to implement it without a code duplication.

aik099 commented 6 months ago

@robocoder , any ideas on how to fix this in the master branch?

robocoder commented 6 months ago

This should be fixed in master now.