I am having issues on performing send keys in a particular EditText
field. I tried a dirty xpath and id but still it does not enter into the text field. However I feel like it is having no issue finding the element. It doesn't click into the element however.
So what happens in the app is that when the user selects the page, it opens up a web view and the EditText
field is in that WebView
.
Here is the dirty xpath I got from the appium inspector:
/hierarchy/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.ScrollView/android.view.ViewGroup/android.view.ViewGroup/android.support.v4.view.ViewPager/android.view.ViewGroup/android.widget.EditText[1]
Here is the nice id:
@FindBy(id = "test_number")
public WebElement testNumberTextField;
I tried using find by xpath using the dirty xpath as well.
Here is my method where I try to enter the text. You can see by the commented code that I tried other things as well to get it working but still no success:
public void enterTestNumber(){
//List<WebElement> menu22 =drive.getDriver().findElements(By.className("android.widget.EditText"));
// menu22.get(1).sendKeys(randomStringGeneratorMethods.randomAlphaNumericString(7));
testPage.testNumberTextField.sendKeys(randomStringGeneratorMethods.randomAlphaNumericString(7));
//js.executeScript("document.getElementById('"+testPage.testNumberTextField+").value='"+randomStringGeneratorMethods.randomAlphaNumericString(7)+"';");
}
The random generator is just a random string generator which is this:
public String randomAlphaNumericString(int characterLength) {
return RandomStringUtils.randomAlphanumeric(characterLength);
}
Does anyone know how to get this working so that it can type text into this EditText
field?
from Unable to sendKeys in an EditText field
No comments:
Post a Comment