We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
7.1
The submitForm(string $button, ...) method indicates :
submitForm(string $button, ...)
@param string $button The text content, id, value or name of the form <button> or <input type="submit">
However, the value attribute doesn't seem to be checked :
value
Symfony\Component\BrowserKit\Exception\InvalidArgumentException: There is no button with "btn_value" as its content, id, value or name.
<form method="post"> <input type="text" id="name" name="name" required> <button type="submit" id="btn_id" name="btn_name" value="btn_value">My button</button> </form>
public function testFormButton(): void { $client = static::createClient(); $client->request('GET', '/'); $client->submitForm('My button', ['name' => 'John']); $client->submitForm('btn_id', ['name' => 'John']); $client->submitForm('btn_name', ['name' => 'John']); $client->submitForm('btn_value', ['name' => 'John']); // this fails }
The XPath query behind this doesn't check the value attribute of <button> tags:
<button>
// Crawler.php public function selectButton(string $value): static { return $this->filterRelativeXPath( sprintf('descendant-or-self::input[((contains(%1$s, "submit") or contains(%1$s, "button")) and contains(concat(\' \', normalize-space(string(@value)), \' \'), %2$s)) or (contains(%1$s, "image") and contains(concat(\' \', normalize-space(string(@alt)), \' \'), %2$s)) or @id=%3$s or @name=%3$s] | descendant-or-self::button[contains(concat(\' \', normalize-space(string(.)), \' \'), %2$s) or @id=%3$s or @name=%3$s]', 'translate(@type, "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "abcdefghijklmnopqrstuvwxyz")', static::xpathLiteral(' '.$value.' '), static::xpathLiteral($value)) ); }
I can work on a PR if you confirm the issue. Thanks
No response
The text was updated successfully, but these errors were encountered:
Hey, thanks for your report! There has not been a lot of activity here for a while. Is this bug still relevant? Have you managed to find a workaround?
Sorry, something went wrong.
Just a quick reminder to make a comment on this. If I don't hear anything I'll close this.
Please open a PR to update the documentation to document the correct behavior (which is the same behavior since years).
submitForm
No branches or pull requests
Symfony version(s) affected
7.1
Description
The
submitForm(string $button, ...)
method indicates :However, the
value
attribute doesn't seem to be checked :How to reproduce
Possible Solution
The XPath query behind this doesn't check the
value
attribute of<button>
tags:I can work on a PR if you confirm the issue. Thanks
Additional Context
No response
The text was updated successfully, but these errors were encountered: