Closed romaricdrigon closed 4 years ago
Hi, I' mot sure this is related to php-webdriver - at least I cannot say from the information you provide.
You said you were able to fix the issue by using Symfony 5? How?
Could you please provide more exact steps to reproduce (include the code you execute, and isolate the issue to some other more simple form? (like here: https://the-internet.herokuapp.com/login , which is also form with method=post).
Using 1.7.1 instead of community
branch helped (sorry if that's not clear, that's unrelated to SF5).
The issue does sound unrelated to php-webdriver, though it is surprising that changing php-webdriver version changes behavior.
I will try to reproduce it.
Oh, thats a different story. So yes, this is possible :smile: , because in W3C mode (which is implemented in commnunity branch), there is not native "submit" feature of WebDriver protocol, and we are emulating it using javascript polyfill. And there may be a bug :thinking: . Cc @dunglas?
Ok, so I digged it up a bit, and found following:
submit
command is no longer part of the protocol, we emulate the submit method using javascript.Your login system probably depends on "submit" value of the POST form. This is something you should not do, it is probably a bug in your application. In Symfony, you should (see Symfony manual) detect whether form was submitted like this:
$form->handleRequest($request);
if ($form->isSubmitted() && $form->isValid()) {
...
}
You are probably doing it some other way, and this causes the issue.
So you options are:
submit()
method on the form itself (or some of its element), but rather click on the submit button:
$submitButton = $driver->findElement(WebDriverBy::name('submit'));
$submitButton->click();
Now the value of submitt button will be sent, for reasons explained in the Stackoverflow answer linked above.
Thank you very much for the investigation, but actually that's not it. i'm using a Symfony "Guard", the check which fails boils down to this: 'user_login' === $request->attributes->get('_route') && $request->isMethod('POST');
.
Dumping $request
object, method is indeed GET
. Behavior using Chrome manually (ie., not headless, not automated) is correct.
I'm working right now on a reproduceable test case (using example.php
as a model). I would appreciate you reopen this issue.
Sure, please provide the reproducible example including the php-webdriver you call and I will have a look 🙂.
Will do. Still, I would appreciate your please re-open this issue, as other persons could join the conversation.
If I can't reproduce it you will still be able to close it, but right now it looks like you were disappointed to be wrong in what you supposed and to act with some bad faith.
Anyway, issue seems unrelated to form action - but instead to form input filling. I will reopen another issue when I get the exact cause.
@romaricdrigon Sorry, I didn't mean it this way.
Yes, please open new issue if you find something new. There definitely is some change of behavior on php-webdriver coming with the W3C protocol (because of the way eg. submit is now handled) - would be great if you can isolate the issue. The W3C implementation is experimental and any feedback is valuable :+1: .
What are you trying to achieve? (Expected behavior)
On our app, we have a login form with
method="post"
. It should be submitted by HTTP POST.How could the issue be reproduced? (Steps to reproduce)
This form will be sent as "GET" under Chrome headless, which causes our authentication system to crash.
How could the issue be reproduced? (Steps to reproduce)
Chromedriver output was not supra helpful in debugging this, but using a fork of php-webdriver 1.7.1 solved the issue (I needed Symfony 5 compatibility). So I wonder from where the issue is coming.
Details
community
branchThe form HTML: