Call EditText setText(CharSequence) method

Hi. I want to set text for EditText field with “mobile: backdoor”:

((JavascriptExecutor)driver).executeScript("mobile:backdoor",ImmutableMap.of(
            "target", "element",
            "elementId", searchField.getId(),
            "methods", ImmutableList.of(
                    ImmutableMap.of("name", "setText"),
                    ImmutableMap.of("args",
                            ImmutableList.of(
                                    ImmutableMap.of(
                                            "value", text,
                                            "type", "java.lang.CharSequence")
                            )))));

Execution of above throws an exception: “An unknown server-side error occurred while processing the command. Original error: No public method setText definded on class android.widget.EditText or its parents which takes argument []”. What I’m doing wrong? Thanks.

P.S. I can’t use sendKeys() method, because element is a search field and when the driver types it updates UI after every charachter and Espresso fails…

I can observe that the method signature of setText is a bit different in the documentation https://developer.android.com/reference/android/widget/EditText#setText(java.lang.CharSequence,%20android.widget.TextView.BufferType)

Hi. Mykola. Thank for answer. I tried such approach:

((JavascriptExecutor) driver).executeScript("mobile:backdoor", ImmutableMap.of(
                "target", "element",
                "elementId", searchField.getId(),
                "methods", ImmutableList.of(
                        ImmutableMap.of("name", "setText"),
                        ImmutableMap.of("args",
                                ImmutableList.of(
                                        ImmutableMap.of(
                                                "value", text,
                                                "type", "java.lang.CharSequence"),
                                        ImmutableMap.of(
                                                "value", "EDITABLE",
                                                "type", "android.widget.TextView.BufferType")

                                )))));

But it tells me:

An unknown server-side error occurred while processing the command. Original error: java.lang.IllegalArgumentException: Class not found: android.widget.TextView.BufferType