Skip to content

Element not interactable even though it is in view (scrolled to) and visible #824

Description

@rodroidrx

Trying to figure out why my script is unable to click on a button even though it is clearly visible and within screen view. This is the only exception I am getting:

  element not interactable
    (Session info: chrome=98.0.4758.102)
    (Driver info: chromedriver=98.0.4758.102 (273bf7ac8c909cde36982d27f66f3c70846a3718-refs/branch-heads/4758@{#1151}),platform=Windows NT 10.0.19043 x86_64) (WebDriver\Exception\ElementNotVisible)

Here's the code that verifies the element and its visibility

    public function getElement($selector, $type = 'xpath', $autodetect = true, $logMessage = true)
    {
        if ($autodetect) {
            $selectorData = $this->detectSelectorType($selector, $type);
            $type = $selectorData[0];
            $selector = $selectorData[1];
        }

        $element = $this->getSession()->getPage()->find($type, $selector);

        $this->log("Selector: ".$selector);

        if (empty($element)) {
            $this->lastElement = false;
            $errorMsg = "No html element found for {$type} selector: {$selector}";
            if ($logMessage) $this->debug($errorMsg);
            throw new Exception($errorMsg);
        } else if ($logMessage) {
            $this->debug("Found element for {$type} selector: {$selector}");
        }

        $this->lastElement = $element;
        $this->log("Element read for clicking");
        return $element;
}

Here's the call to click

    $this->getElement($selector, $selectorType)->click();

I'm running on chrome 98.0.4758.102, selenium 3.141 and the following behat/mink versions

  "behat/mink": "v1.7.1",
    "behat/mink-goutte-driver": "v1.2.1",
    "behat/mink-selenium2-driver": "*",
    "behat/behat": "v3.5.0",
    "behat/mink-extension": "v2.2",

I've already tried various implicit and explicit waits / scrolls but still no go

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions