Skip to content

Commit 049b638

Browse files
authored
Support HTML5 form attribute
Codeception/Codeception#5477
1 parent 3e5df13 commit 049b638

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/Codeception/Lib/InnerBrowser.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -447,6 +447,18 @@ private function clickButton(\DOMNode $node)
447447
$formParams = [$buttonName => $buttonValue];
448448
}
449449

450+
if (!empty($node->getAttribute('form'))) {
451+
$formCrawler = $this->filterByCSS('#' . $node->getAttribute('form'));
452+
if ($formCrawler->count() !== 1) {
453+
throw new TestRuntimeException("Found form with id {$node->getAttribute('form')} {$formCrawler->count()} times, expected exactly 1");
454+
}
455+
$this->proceedSubmitForm(
456+
new Crawler($formCrawler->getNode(0), $this->getAbsoluteUrlFor($this->_getCurrentUri()), $this->getBaseUrl()),
457+
$formParams
458+
);
459+
return true;
460+
}
461+
450462
while ($node->parentNode !== null) {
451463
$node = $node->parentNode;
452464
if (!isset($node->tagName)) {

0 commit comments

Comments
 (0)