I am facing this problem on Firefox v.59, Selenium 3.11.0. I just click on an element, like this:

webDriver.findElement(By.id("row_0")).click();

and I get exception:

org.openqa.selenium.ElementNotInteractableException: Element <tr id="row_0" class="row_0 txtSearchColor1"> could not be scrolled into view

I already try with JavascriptExecutor like this:

js.executeScript("arguments[0].scrollIntoView(true);", webDriver.findElement(By.id("row_0")));
js.executeScript("arguments[0].click();", webDriver.findElement(By.id("row_0")));

but nothing works, it does nothing. This is element HTML:

<tr id="row_0" class="row_0 txtSearchColor1">
   <td></td>
   <td></td>
   <td></td>
</tr>

Note that, all the solutions work normally on Chrome (v65) and this element is visible. Does anyone have the same problem and a solution? Thanks

EDIT: HTML code of the elements: enter image description here

  • 1
    Does it work on Firefox<59? – V.A. Mar 24 at 8:31
  • What happens when you do? "scrollIntoView(false);" – V.A. Mar 26 at 20:35
  • @VishalAggarwal Hi, I already tried it js.executeScript("arguments[0].scrollIntoView(false);", element); , but it did nothing, it just bypassed the block, no exception. As you can see my discussion below, I tried with both whole row (throw exception) or one column (just bypassed), but nothing worked – Ragnarsson Mar 27 at 7:51
up vote 4 down vote accepted

A workaround that works for me so far is that I use a 'fake' tr:

  • Find the tr I want to click
  • Find a td that belongs to that tr and click on it. it works

This bug is reported on Bugzilla and this workaround is recommended

  • Can you link the issue? – Tamir Daniely Jul 1 at 8:03
  • @TamirDaniely I linked the issue, it was filed on Bugzilla for FF – Ragnarsson Jul 3 at 14:34

Wait for sometime before clicking.Give the page some time to load/scroll to the element.

  • I tried everything: Thread.sleep() or explicit and implicit Wait or waitForPageLoad() with "return document.readyState" or I debugged it, and let it wait until everything stable before I moved to next line to click, but I still get the same error on Firefox – Ragnarsson Mar 26 at 8:49

I also use a javascript to scroll an element into view, but I use the x and y positions, and I also wait for jquery to be active:

public static void scrollIntoView(WebElement ele) {
    ((JavascriptExecutor)driver).executeScript("window.scrollTo(" + ele.getLocation().x + "," + ele.getLocation().y + ")");
    waitForJQueryToBeActive();
}

public static void waitForJQueryToBeActive() {
    Boolean isJqueryUsed = (Boolean) ((JavascriptExecutor) driver)
            .executeScript("return (typeof(jQuery) != 'undefined')");
    if (isJqueryUsed) {
        while (true) {
            // JavaScript test to verify jQuery is active or not
            Boolean ajaxIsComplete = (Boolean) (((JavascriptExecutor) driver)
                    .executeScript("return jQuery.active == 0"));
            if (ajaxIsComplete)
                break;
            try {
                Thread.sleep(100);
            } catch (InterruptedException e) {
            }
        }
    }
}
  • Thanks for your answer. I tried it, but unfortunately, it doesn't work too, it passes these lines and does nothing, like all my solutions. Of course, it works for Chrome, only Firefox doesn't. – Ragnarsson Mar 26 at 15:10
  • Does it attempt to scroll, at least, or does it just immediately fail? Perhaps you could try scrolling to another element that's at or below the desired one, then attempt to access the one you want? – Bill Hileman Mar 26 at 15:19
  • It doesn't attempt to scroll, it just rans through the block. I also tried your suggestion to findElements which has this one in the group, and I tried to click on it, and I get exactly error like others, "Element could not be scrolled into view" :( – Ragnarsson Mar 26 at 15:40
  • Can you share in your original post at least a segment of the HTML. I wonder if there might be an invisible blocker element of some kind, or perhaps is the element in an iframe? – Bill Hileman Mar 26 at 15:44
  • I don't think it is in a iframe, just table inside table. I updated my post. I tried to click all the ids around it, but nothing works. – Ragnarsson Mar 26 at 15:57

I faced the same issue when I upgraded to new Firefox version 63. I have used the Actions class to click an element. Give a try!

WebElement  element = WebDriver.findElement("locator");               
Actions act=new Actions(driver);
act.moveToElement(element).click().perform();
New contributor
Venkat is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.

Your Answer

 

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.