Skip to content

ChromeDriver 131 sends undefined arguments to JavascriptExecutor when arguments are type WebElementΒ #162

@MxyL

Description

@MxyL

Describe the bug

In Java Selenium WebDriver 2, we click elements by obtaining a WebElement reference using driver.findElement( ... ) and then we use javascript executor to call the click method.

This works fine in 130. Since updating to 131, clicking no longer works, with the following error reported

org.openqa.selenium.WebDriverException: javascript error: Cannot read properties of undefined (reading 'click')

To reproduce

I print to console the number of elements found and what the elements are.

List<WebElement> elmts = driver.findElements(By.xpath(YOUR_XPATH));
(JavascriptExecutor) driver).executeScript("console.log(arguments[0])", elmts.size());
(JavascriptExecutor) driver).executeScript("console.log(arguments[0])", elmts);

Expected behavior

I should see the number of elements, along with an array of the specified elements.

It does print the correct number of elements, but it's simply an array of undefined.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions