Quantcast
Channel: Active questions tagged selenium - Stack Overflow
Viewing all articles
Browse latest Browse all 97792

Selenium JS Executor Failure: "Failed to execute elementsFromPoint on Document"

$
0
0

I'm running code that fetches a span by the value of its text and then goes to rightclick it using this function:

public void rightClickElement(WebElement element) {
        Actions action = new Actions(driver);
        actions.contextClick(element).perform();
    }

Basically I iterate over a list of filenames and select the element I want to manipulate by its filename by using the following XPATH:

//span[contains(text(), 'PLACEHOLDER')]

with a function that replaces PLACEHOLDER by the current value of the array of filenames I'm iterating over.

This is my code:

*Note: getAssertedElement is just a function I wrote that asserts an element's existence and returns it at the same time.

List<WebElement> textFilesElements = driver.findElements(By.xpath("//span[(@class='document') and contains(text(), '.txt')]"));
ArrayList<String> filesToDelete = new ArrayList<String>();
waitSeconds(1);
for (int i = 0; i < textFilesElements.size(); i++) {
    filesToDelete.add(textFilesElements.get(i).getText());
}

for (int i = 0; i < filesToDelete.size(); i++) {
    WebElement elementToDelete = getAssertedElement("Cannot find the current element",
            replacePlaceholderInString(
                    "//span[contains(text(), 'PLACEHOLDER')]",
                    filesToDelete.get(i)
                    ),
            "xpath");
    System.out.println("FICHIER TO DELETE" + elementToDelete.getText());
    rightClickElement(elementToDelete);
    // do things with element
    ...
}

This works fine the first time through the second for statement, but when I move on to the next filename, even though the element is visible and clickable, the test fails with the following error when it reaches the rightClickElement call:

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

I don't understand why, much less how to fix it.


Viewing all articles
Browse latest Browse all 97792

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>