String text = "";
String parseText = "";
for(int i = 0; i < fileCount ; i++){
String xpath = "//android.widget.RelativeLayout[@resource-id='com.app.package:id/item']["+i+"]"
+ "//android.widget.TextView";
text = appium.getText(By.xpath(xpath));
getText method
public String getText(By locator) {
WebElement element = waitForIsElementPresent(locator);
return element.getText();
}
I can not get text
why ?
This is not related to appium, please google
this is same appium.
in fact. this is real code.
String xpath = “//android.widget.RelativeLayout [@resource-id=‘com.app.package:id/item’][0]”
+ “//android.widget.TextView ”;
WebElement element = driver.findElement(xpath);
text = element.getText(element);
but this is not working
element.getText(element); Why ??
just use element.getText();
Ajinkya
February 13, 2018, 2:15pm
5
This won’t work and don’t try this solution
Please try this
Webelement elt=driver.findElement(by.xpath(“yourxpath[contains(text(),“Text you want to search”)]”);