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();
@Before
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);
driver.setLogLevel(Level.INFO);
}
@Test
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();
driver.findElement(By.xpath("//[@text=‘No Recipient Selected’]")).click();
driver.findElement(By.xpath("//[@text=‘Guardians’]")).click();
driver.findElement(By.xpath("//[@text=‘Guardians
0 Guardians selected
Select’]")).click();
driver.findElement(By.xpath("//[@text=‘Developer International School.’]")).click();
driver.findElement(By.xpath("//[@contentDescription=‘pathu’]")).click();
driver.findElement(By.xpath("//[@contentDescription='1
']")).click();
driver.findElement(By.xpath("//[@text=‘DONE
1’]")).click();
new WebDriverWait(driver, 20).until(ExpectedConditions.presenceOfElementLocated(By.xpath("//[@class=‘android.widget.EditText’")));
driver.findElement(By.xpath("//[@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’]]")));
driver.findElement(By.xpath("//[@class=‘android.view.View’ and ./parent::*[@id=‘inputArea’]]")).click();
}
@After
public void tearDown() {
driver.quit();
}
}
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.