Skip to content

The LegacyWindow class doesn't work anymore #138

@aik099

Description

@aik099

The LegacyWindow class in the master branch no longer includes a window handle (or current for the current window) in the made cURL requests to the Selenium server. This results in the /session/{sessionId}/window/size URL instead of the /session/{sessionId}/window/{windowHandle}/size URL.

Constructor declaration change fixes all window commands, except for the LegacyWindow::getHandle method:

if ($windowHandle === null) {
    $windowHandle = 'current';
}

parent::__construct($url . '/' . $windowHandle);

// The "current" meta-handle isn't accepted by any other command.
if ($windowHandle !== 'current') {
    $this->windowHandle = $windowHandle;
}

With the above fix the LegacyWindow::getHandle now queries the /session/{sessionId}/window/{windowHandle}_handle URL instead of the /session/{sessionId}/window_handle.

Since the \WebDriver\AbstractWebDriver::curl method can't subtract URL parts, then the only way to fix this was actually to implement all the window manipulation methods instead of relying on the AbstractWebDriver::__call method.

P.S.
Apparently, the JsonWireProtocol supports resizing of the non-active windows, which W3C does not allow.

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