grafana / xk6-browser

The browser module adds support for browser automation and end-to-end web testing via the Chrome Devtools Protocol to k6.
https://grafana.com/docs/k6/latest/javascript-api/k6-browser/
GNU Affero General Public License v3.0
343 stars 41 forks source link

Errors when using `fill()` on a textarea Locator #1225

Closed iandesj closed 8 months ago

iandesj commented 8 months ago

Brief summary

When I locate a textarea tag and try to fill it with Locator.fill(), I encounter an Uncaught (in promise) GoError. I have asserted that the element is visible with Locator.isVisible()

k6 version

k6 v0.49.0 (go1.21.6, darwin/amd64)

OS

macOS 11

Docker version and image (if applicable)

No response

Steps to reproduce the problem

  1. Locate the textarea in question with:
    const textArea = page.locator('textarea[aria-label="Paste your own text here"]');
  2. Attempt to fill it with:
    textArea.fill(aBigStringValue);
  3. Encounter error when running tests, like so:
    ERRO[0008] Uncaught (in promise) GoError: filling "textarea[aria-label=\"Paste your text here\"]" with "In the heart of an ancient forest, where the trees whispered secrets...

Expected behaviour

I would expect the textarea to fill with the value I provided it, considering it is visible. I'll add that Locator.type() function works as expected with the same string value I'm passing to Locator.fill().

Actual behaviour

ERRO[0008] Uncaught (in promise) GoError: filling "textarea[aria-label=\"Paste your text here\"]" with "In the heart of an ancient forest, where the trees whispered secrets of a bygone era, there existed a village untouched by time. This village, known as Eldoria, was home to a peculiar person named Elian. Elian was unlike anyone else in Eldoria; he possessed an innate ability to communicate with the natural world around him. His days were spent wandering the forest, conversing with the wind, and learning the dialects of the streams.\nElian's unique gift was both a blessing and a burden. While he cherished his deep connection with nature, he often felt isolated from his fellow villagers. They respected his abilities but kept their distance, unsure of how to interact with someone who spent more time with trees than with people.\nOne day, as Elian was exploring the outer edges of the forest, he stumbled upon a clearing he had never seen before. In the center of this clearing stood a colossal oak tree, its branches reaching towards the sky as if in silent supplication. Elian approached the tree, sensing an ancient power emanating from its core.\nAs he placed his hand on the rough bark, a voice echoed in his mind, \"Elian, protector of the forest, you have been chosen.\" Startled, Elian looked around, but saw no one. The voice continued, \"A darkness looms over Eldoria, one that threatens the very essence of this land. You must journey to the Crystal Caverns and retrieve the Heartstone, the only object capable of dispelling this shadow.\"\n": needsinput
    at github.com/grafana/xk6-browser/common.(*Locator).Fill-fm (native)
### Tasks
- [ ] https://github.com/grafana/xk6-browser/pull/1238
- [ ] https://github.com/grafana/k6/pull/3636
oleiade commented 8 months ago

Hey @iandesj 👋🏻

Thanks for reporting this issue. I think @ankur22 and @inancgumus will probably be better suited to look into it 👀

bandorko commented 8 months ago

I will fix this