javascript error: Failed to execute 'elementsFromPoint' on 'Document': The provided double value is non-finite

Solution 1:

This error message...

Javascript error: Failed to execute 'elementsFromPoint' on 'Document': The provided double value is non-finite

...implies that the WebDriver instance was unable to find the element for one or the other reasons:

  • The element haven't loaded properly when you tried to interact with it.
  • Element is within an <iframe> / <frame>
  • The style attribute of the element contains display: none;
  • Element is within an shadow DOM

The relevant HTML would have been helpful to analyze the issue in a better way. However, you need to take care of a couple of things as follows:

  • The id attribute of the <select> tag is attribute178 which is clearly dynamic. So you need to construct a dynamic Locator Strategy

  • As the id attribute of the <select> tag is dynamic, you need to induce WebDriverWait for the element_to_be_clickable() and you can use either of the following Locator Strategies:

  • cssSelector:

    Select s = new Select(new WebDriverWait(getDriver(), 20).until(ExpectedConditions.elementToBeClickable(By.cssSelector("select.super-attribute-select[id^='attribute']"))));
    s.selectByIndex(1);
    
  • xpath:

    Select s = new Select(new WebDriverWait(getDriver(), 20).until(ExpectedConditions.elementToBeClickable(By.xpath("//select[@class='super-attribute-select' and starts-with(@id, 'attribute')]"))));
    s.selectByIndex(1);