How to append text to a text field

In Appium 1.7.2 element.setValue() would append to a field. But it looks like after that, setValue replaces data in the field. sendKeys() also does this. I have a need to type a few characters, wait, then type a few more characters without clearing the field. We should be able to support this some way or another (btw… need to do this in Android and iOS).

I’ve also tried this, but unfortunately get an Unsupported exception

Keyboard keyboard = getTravelerClient().getAppDriver().getKeyboard();
keyboard.sendKeys("Hello");
keyboard.sendKeys("World");

I don’t like it (since it’s harder to abstract), but this is a ‘meh’ workaround and only works for Android

element.click();

((AndroidDriver) getTravelerClient().getAppDriver()).pressKey(new KeyEvent(AndroidKey.F).withMetaModifier(KeyEventMetaModifier.SHIFT_ON));
((AndroidDriver) getTravelerClient().getAppDriver()).pressKey(new KeyEvent(AndroidKey.O));
((AndroidDriver) getTravelerClient().getAppDriver()).pressKey(new KeyEvent(AndroidKey.O));

// DO STUFF HERE

((AndroidDriver) getTravelerClient().getAppDriver()).pressKey(new KeyEvent(AndroidKey.B));
((AndroidDriver) getTravelerClient().getAppDriver()).pressKey(new KeyEvent(AndroidKey.A));
((AndroidDriver) getTravelerClient().getAppDriver()).pressKey(new KeyEvent(AndroidKey.R));

try W3C actions: new Actions(driver).sendKeys(string)

Worked great for Android. Any reason why WDA doesn’t support it?

org.openqa.selenium.WebDriverException: An unknown server-side error occurred while processing the command. Original error: Error Domain=com.facebook.WebDriverAgent Code=1 "Only actions of 'pointer' type are supported. 'key' is given instead for action with id 'default keyboard'" UserInfo={NSLocalizedDescription=Only actions of 'pointer' type are supported. 'key' is given instead for action with id 'default keyboard'}
Build info: version: '3.12.0', revision: '7c6e0b3', time: '2018-05-08T14:04:26.12Z'
System info: host: 'bedouglas-mac', ip: 'fe80:0:0:0:cbc:ad00:a180:4b3c%en0', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.13.6', java.version: '1.8.0_181'
Driver info: io.appium.java_client.TAIOSDriver
Capabilities {app: https://qa.hq.internalhl.co..., automationName: XCuiTest, browserName: , bundleId: com.tripadvisor.prerelease, clearSystemFiles: true, databaseEnabled: false, deviceName: a8df4ebf42788c3645264c4cb3b..., fullReset: true, javascriptEnabled: true, locationContextEnabled: false, networkConnectionEnabled: false, newCommandTimeout: 45, noReset: false, platform: MAC, platformName: iOS, platformVersion: ANY, preventWDAAttachments: true, sendKeyStrategy: grouped, server:CONFIG_UUID: 0d7b545b-a524-4e0c-9fb4-505..., simpleIsVisibleCheck: true, systemPort: 7838, takesScreenshot: true, tripadvisor:platformType: Phone, tripadvisor:testng.hostname: bedouglas-mac, tripadvisor:testng.session.hash: dec7ab29-f4fe-4a58-b954-28c..., tripadvisor:testng.suite: Default Suite, tripadvisor:testng.test: setupClient, udid: a8df4ebf42788c3645264c4cb3b..., updatedWDABundleId: com.tripadvisor.qa.WebDrive..., useNewWDA: true, wdaLocalPort: 7838, webStorageEnabled: false, xcodeOrgId: 24X86T8MC6, xcodeSigningId: iPhone Developer}
Session ID: 61656578-39a4-4389-8510-7f2143232881

This is the limitation of XCTest framework. Although, the keyboard is accessible on iOS, so you could simply tap the corresponding keys by locating them