Skip to content

fix: use W3C WebDriver text format for element value input - #1

Open
daifma wants to merge 1 commit into
eDiasoft:masterfrom
daifma:fix/w3c-postvalue-format
Open

fix: use W3C WebDriver text format for element value input#1
daifma wants to merge 1 commit into
eDiasoft:masterfrom
daifma:fix/w3c-postvalue-format

Conversation

@daifma

@daifma daifma commented Feb 8, 2026

Copy link
Copy Markdown

Problem

The driver sends {"value": ["text"]} (legacy JSON Wire Protocol format) in postValue() calls,
but Selenium 4+ with ChromeDriver requires {"text": "string"} per the
W3C WebDriver specification.

This causes setValue(), attachFile(), and file upload to silently fail or throw errors
when used with Selenium 4 standalone Chrome.

Fix

Replace all three occurrences of the legacy format with W3C-compliant format:

# setValue() — file input (line ~635)
- $element->postValue(array('value' => array(strval($value))));
+ $element->postValue(['text' => strval($value)]);

# setValue() — text input/textarea (line ~652)
- $element->postValue(array('value' => array($value)));
+ $element->postValue(['text' => $value]);

# attachFile() (line ~777)
- $element->postValue(array('value' => array($remotePath)));
+ $element->postValue(['text' => $remotePath]);

How to reproduce

  1. Use selenium/standalone-chrome:latest (Selenium 4+)
  2. Configure Behat with ediasoft/mink-selenium4-driver
  3. Try to fill a text field with $session->getPage()->fillField('name', 'value')
  4. Observe: ChromeDriver rejects the {"value": [...]} payload

References

Replace legacy JSON Wire Protocol format {"value": ["text"]} with
W3C-compliant {"text": "string"} in postValue() calls.

Selenium 4+ with ChromeDriver requires the W3C format per
https://www.w3.org/TR/webdriver2/#element-send-keys

This fixes setValue(), attachFile(), and file upload when used
with selenium/standalone-chrome containers.
@daifma

daifma commented Feb 16, 2026

Copy link
Copy Markdown
Author

@ShuCh3n PLZ review !

@daifma

daifma commented May 13, 2026

Copy link
Copy Markdown
Author

@ShuCh3n ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant