Skip to content

Fixed the issue with new selenium v2.35 session id retrieval handshake #266

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

zerkms
Copy link
Collaborator

@zerkms zerkms commented Aug 12, 2013

A fix for #265

@webdigi
Copy link

webdigi commented Aug 15, 2013

Great the fix works! verified with selenium v2.35 on mac

@julianseeger
Copy link
Contributor

Looks like Giorgio is deadlocked in distributed transactions, but we really need a merge here.
Since Firefox 23 does not work well with selenium < 2.35 and phpunit-selenium is meant to work with firefox, there is no argument in supporting only selenium <= 2.33.

@zerkms
Copy link
Collaborator Author

zerkms commented Aug 19, 2013

$sessionId = $this->jsonResponse['sessionId'];

// if url doesn't have sessionId included - append it manually
// this change was performed in selenium v2.35

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

was performed in selenium 2.34

// @see https://code.google.com/p/selenium/issues/detail?id=6089
// @see https://github.com/sebastianbergmann/phpunit-selenium/issues/265
if (strpos($url, $sessionId) === false) {
$url = trim($url, '/') . '/' . $sessionId;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i have been checked this and i have seen that the $this->info['url'] is not including the ending /, you can check also

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@felixcarmona yep, it doesn't at the moment, but I don't see any guarantee that JsonWireProtocol provides about it

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@zerkms, so, should sanitize it always no?, not only in this if statement no?
i think this trim (or rtrim) should be done when the $url is setted at the first time:
$url = rtrim($this->info['url'], '/');

// @see https://code.google.com/p/selenium/issues/detail?id=6089
// @see https://github.com/sebastianbergmann/phpunit-selenium/issues/265
if (strpos($url, $sessionId) === false) {
$url = rtrim($url, '/') . '/' . $sessionId;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not rtrim the $url when the $url contains the $sessionId?
why not do the rtrim when you set the $url at the first time?
$url = rtrim($this->info['url'], '/');

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@felixcarmona the aim of this patch is to bring phpunit-selenium back to work, so I implemented the fix in the most clear and obvious way I see it :-)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so, the url sanitize in the if statement (with rtrim) is also out of the aim of the patch proposal, the url should be sanitized at the two ways or at nothing

@felixcarmona
Copy link

👍

@zerkms
Copy link
Collaborator Author

zerkms commented Aug 20, 2013

@felixcarmona finally I could satisfy your demands :-)

giorgiosironi added a commit that referenced this pull request Aug 21, 2013
Fixed the issue with new selenium v2.35 session id retrieval handshake
@giorgiosironi giorgiosironi merged commit a573a76 into giorgiosironi:master Aug 21, 2013
@giorgiosironi
Copy link
Owner

Do we need a new release right now or master is fine?

@felixcarmona
Copy link

master seem fine, because this change respects the retrocompatibility

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants