GoogleChromeLabs / GoogleChromeLabs/chrome-for-testing
ChromeDriver 131 sends undefined arguments to JavascriptExecutor when arguments are type WebElement
- Dominant language
- JavaScript
- Stars
- 1.3k
- Forks
- 159
- Avg merge
- 18h 37m
- Merged PRs (30d)
- 3
Description
**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 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.
Contributor guide
Research direction
Start with the Java reproduction using findElements and JavascriptExecutor, then compare the behavior between ChromeDriver 130 and 131. Verify whether passing the WebElement list produces undefined values in 131 and define done as restoring the expected element array and click behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, javascript
- Domain
- testing-qa
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100