Text not entering when playback the script

When playback the script the text unable to enter in the text field, even i try the different xpaths still not working and showing the error in logs, Plz somebody give the suggestion ASAP

//package ;
import io.appium.java_client.remote.AndroidMobileCapabilityType;
import io.appium.java_client.android.AndroidDriver;
import io.appium.java_client.android.AndroidElement;
import io.appium.java_client.remote.MobileCapabilityType;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.WebDriverWait;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.openqa.selenium.By;
import org.junit.*;
import java.net.URL;
import java.net.MalformedURLException;
import java.util.logging.Level;

public class MessageComposingStaff {
private String reportDirectory = “reports”;
private String reportFormat = “xml”;
private String testName = “MessageComposingStaff”;
protected AndroidDriver driver = null;

DesiredCapabilities dc = new DesiredCapabilities();

public void setUp() throws MalformedURLException {
    dc.setCapability("reportDirectory", reportDirectory);
    dc.setCapability("reportFormat", reportFormat);
    dc.setCapability("testName", testName);
    dc.setCapability(MobileCapabilityType.UDID, "33003660511683ab");
    driver = new AndroidDriver<>(new URL("http://localhost:4723/wd/hub"), dc);

public void testMessageComposingStaff() {
    driver.findElement(By.xpath("//*[@class='android.widget.Button' and (./preceding-sibling::* | ./following-sibling::*)[@class='android.widget.ScrollView']]")).click();
    new WebDriverWait(driver, 30).until(ExpectedConditions.presenceOfElementLocated(By.xpath("//*[@text='Reply Request

Allows user to reply to your message’]")));
driver.findElement(By.xpath("//[@text=‘Reply Request
Allows user to reply to your message’]")).click();
[@text=‘No Recipient Selected’]")).click();
0 Guardians selected
driver.findElement(By.xpath("//[@text=‘Developer International School.’]")).click();
new WebDriverWait(driver, 20).until(ExpectedConditions.presenceOfElementLocated(By.xpath("//[@class=‘android.widget.EditText’")));
[@xpath//[@text=’‘Start Typing here’]’]")).sendKeys(“This is an automated message”);
new WebDriverWait(driver, 30).until(ExpectedConditions.presenceOfElementLocated(By.xpath("//
[@class=‘android.view.View’ and ./parent::[@id=‘inputArea’]]")));
[@class=‘android.view.View’ and ./parent::*[@id=‘inputArea’]]")).click();

public void tearDown() {


ERROR: ----> 12:07:50 PM Send text This is an automated message to element NATIVE:xpath//*[@text=‘Start Typing here’][0]

ERROR: ----> 12:07:50 PM RuntimeException: Instrumentation has failed. Failed to identify UI elements or the application is not launched.

Did you record the script with install/launch the application in Instrumentation mode?

Yes, i tried enabling the instrument option and recorded my worflow but the recorded xpaths are different from, where i recorded non-instrument mode

i did both ways but still i got failure in my script, i used all possible xpaths to simulate the entering text during the replay, only that is not working @kishore is there any other workaround solution ?

I am not completely sure if this is problem of timing (element is not yet in screen) or its the way the test was recorded.

One suggestion I can give is …

  1. First find the correct Xpath

  2. Change the script Xpath with step 1.b xpath

This is make sure that this is not due to the xpath problem