mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
Make HTML Field button step find more lenient for conditional labels (#8328)
This commit is contained in:
parent
735c87b709
commit
dcebf56056
@ -239,7 +239,14 @@ JS;
|
|||||||
$session = $this->getSession();
|
$session = $this->getSession();
|
||||||
$element = $session->getPage()->find('xpath', $xpath);
|
$element = $session->getPage()->find('xpath', $xpath);
|
||||||
if (null === $element) {
|
if (null === $element) {
|
||||||
throw new \InvalidArgumentException(sprintf('Could not find element with xpath %s', $xpath));
|
// If it can't find the exact name, find one that starts with the phrase
|
||||||
|
// Helpful for "Insert link" which has a conditional label for keyboard shortcut
|
||||||
|
$xpath = "//*[@aria-label^='" . $button . "']";
|
||||||
|
$element = $session->getPage()->find('xpath', $xpath);
|
||||||
|
|
||||||
|
if (null === $element) {
|
||||||
|
throw new \InvalidArgumentException(sprintf('Could not find element with xpath %s', $xpath));
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
$element->click();
|
$element->click();
|
||||||
|
Loading…
Reference in New Issue
Block a user