-
Notifications
You must be signed in to change notification settings - Fork 849
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Bug description
WebDriverExpectedCondition::elementToBeClickable should check if an element is clickable.
Elements that have CSS pointer-events: none set are not clickable. This should be considered in the check for clickability.
Also see: SeleniumHQ/selenium#14427
How could the issue be reproduced
$I->waitForElementClickable('button');using Codeception Module WebDriver v4.0.2
public function waitForElementClickable($element, int $timeout = 10): void
{
$condition = WebDriverExpectedCondition::elementToBeClickable($this->getLocator($element));
$this->webDriver->wait($timeout)->until($condition);
}Expected behavior
This should not select an element as follows:
HTML:
<button class="disabled">…</button>CSS:
.disabled {
pointer-events: none;
}Php-webdriver version
1.12
PHP version
8.3
How do you start the browser driver or Selenium server
Don't know - TYPO3 test environment
Selenium server / Selenium Docker image version
No response
Browser driver (chromedriver/geckodriver...) version
No response
Browser name and version
chrome-headless-shell=124.0.6367.118
Operating system
No response
Additional context
php-webdriver/lib/WebDriverExpectedCondition.php
Lines 406 to 434 in 11923b4
| /** | |
| * An expectation for checking an element is visible and enabled such that you can click it. | |
| * | |
| * @param WebDriverBy $by The locator used to find the element | |
| * @return static Condition return the WebDriverElement once it is located, visible and clickable. | |
| */ | |
| public static function elementToBeClickable(WebDriverBy $by) | |
| { | |
| $visibility_of_element_located = self::visibilityOfElementLocated($by); | |
| return new static( | |
| function (WebDriver $driver) use ($visibility_of_element_located) { | |
| $element = call_user_func( | |
| $visibility_of_element_located->getApply(), | |
| $driver | |
| ); | |
| try { | |
| if ($element !== null && $element->isEnabled()) { | |
| return $element; | |
| } | |
| return null; | |
| } catch (StaleElementReferenceException $e) { | |
| return null; | |
| } | |
| } | |
| ); | |
| } |
Adding $element->getCSSValue('pointer-events') !== 'none' to the condition might give the expected result.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working