minkphp / minkphp/Mink

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

Open
#824 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
PHP
Stars
1.6k
Forks
286
PR merge metrics
No merged PRs in 30d

Description

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The report names only the getElement method and its subsequent click call, with no repository file or test to inspect. Start by reproducing the interaction using the listed Chrome, Selenium, Behat, and Mink versions; done would require an agreed reproducible cause and a specific code or test change, neither of which the issue currently defines.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
testing-qa
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
15/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.