getValue() empty string android webview


I have a android app with a few webviews in them. After switching to the webview context, and the correct windowHandle I want to set some text to a html input.

After setting the text I want to assert that it actually is send, but in Android only (iOS works, same code) the call to element.getValue() yields empty string.

Appium v2.0.0-rc.3
[email protected]

(android 13 is running in simulator, debug mode is enabled)

Relevant code:

const emailField = await Element.getElement(emailIdentifier, emailAccessorType); //email, id
await emailField.setValue(username);
const actualEmailFieldValue = await emailField.getAttribute(‘value’); // empty, same with emailField.getValue()
const elem = await $(’#email’); // idea: re-fetch element?
const f = await elem.getValue(); // empty

this is running from webdriver io and I saw the docs there:

whats odd here is that I can see the value changing in the app (simulator), so the “setValue” works just fine (but I want to be sure with the assert)

This has been resolved partially. I set up a real android device running Android 7.0 and it works there just fine. I will test if thats something from the simulator (aka API level) or something later.

But I don’t know how. I reinstalled / update UIAutomator, and Appium CLI. Maybe that did something.

[email protected]
Appium v2.0.0-rc.4

I’ve tried simulators running android versions from 10 to 13, all with the same error.

This workaround worked, so I am still in the “correct” context:

if (actualEmailFieldValue.length === 0) { // previous getValue() call yielded empty string
        // Try again, but with plain js return callback
        actualEmailFieldValue = await driver.executeScript(
            `return document.getElementById('${emailIdentifier}').value;`,
        ) ?? '';

But I didnt like that very much.
Later on, after I added those extra workarounds in, a different part crashed and complained with the error “cannot call non w3c standard command while in w3c mode”.

So I searched the internet for that and I got to this issue

I tried it, by setting this to my capabilities:

export const androidSimulator = {
// ...
"appium:chromeOptions": {'w3c': false},
// ...

And voilá, the initial call to getValue works now just fine - and I can get rid of my workarounds.

I will continue to observe this, because I do not understand what “w3c mode” means yet.