Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
rodroidrx opened this issue Feb 22, 2022 · 1 comment

Comments

@rodroidrx
Copy link

rodroidrx commented Feb 22, 2022

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

@aik099
Copy link
Member

aik099 commented Feb 23, 2022

@rodroidrx , have you tried using Firefox instead of Chrome with Selenium?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants