Unable to enter data on edittext fields of appium - android

I am entering data on these checkboxes. The script runs fine but data does not enters. Check the code below:
List<WebElement>pincode = driver.findElements(By.id("com.theentertainerme.entertainer:id/pin_code_round)"));
pincode.get(0).sendKeys("0");
pincode.get(1).sendKeys("0");
pincode.get(2).sendKeys("0");
pincode.get(3).sendKeys("0");
Check UI of screen
Image added is of UiAutomatorViewer
Please help me out on this.

Instead of doing like that you can enter the four digits by using android keycodes.
driver.pressKeyCode(AndroidKeyCode.KEYCODE_1);
driver.pressKeyCode(AndroidKeyCode.KEYCODE_1);
driver.pressKeyCode(AndroidKeyCode.KEYCODE_1);
driver.pressKeyCode(AndroidKeyCode.KEYCODE_1);
This will enter all 1's in the four fields.

Related

Not able to enter the data with SendKeys Method in appium

I am trying to enter my email address in the field, but when I inspect the element I see a very big rectangle for the edit box. Though I am able to find that through class name. but when I try to enter the value through SendKeys method, My test gets passed, but I am not able to see the text entered in the field. Take a look at the screenshot of the mobile view. Mobile View
PS: I am testing the flutter application. So does it make any difference?
Thanks in advance.
Your definition for Email_input is by class name and not an xpath, so you don't need the forward slashes. It should be:
private By Email_input = By.className("android.widget.EditText");
Don't know what your Parent_Signin_pageObject class does but ultimately you would need something like this to enter the text:
driver.findElement(Email_input).sendKeys("user#gmail.com");

Sendkeys() not release the Element in Android App using Appium

WebElementUserAccount=driver.findElement(By.xpath("//android.widget.EditText[#content-desc='User account']"));
UserAccount.click();
UserAccount.sendKeys("Test");
When I use this code it is not releasing the User account element it sends the text successfully but not came out of it
In the second element, I have to send the password but it will not come out from the first Element
When I use
WebElement UserName= driver.findElement(By.xpath("//android.widget.EditText[#content-desc='User account']"));
WebElement Password= driver.findElement(By.xpath("//android.widget.EditText[#content-desc='Password']"));
UserName.sendKeys("UserName");
The Android keybord open before sending the text and it starts writing in the second element
Use driver.hideKeyboard(); after entering text in your first element. Your keyboard might be hiding next element.
Whenever you do automation its better to turn off the text suggestion(predictive text) in the mobile keyboard.
Check whether the keyboard is displayed . If displayed use the following code:
driver.hideKeyboard();

How to set a part of validation in saripaar?

When I use android-saripaar I want to use only some of the validation. I used the ViewPager and had a dozen of EditText. Each page had some inputs. And I want to validate the inputs at every step.
For example, I had username and password at first step, and phone, email at the second. If user type in the invalid data at first step, validation worked.
Finally I find the answer in the ISSUE : https://github.com/ragunathjawahar/android-saripaar/issues/104#issuecomment-133822417

Android - how to create custom word dictionary for only my application?

I have successfully added a word to Android's predefined user dictionary, but i want to create a custom dictionary which can only be accessed by my application.
For example: When i type "lol", the suggestions show me "laugh out loud" but when I want another meaning of "lol" then I can manually add another meaning of "lol" (eg, "xxxxxx" - so the next time the user writes "lol" in an EditText, the suggestions will show him "xxxxxx").
No other application should have access my dictionary data.
I have worked with spell checker class but it gives me only correct word and I can't my own word meanings.
Please give me some suggestions or links.
There is an Androids inbuilt class UserDictionary so that you can add your spells programmatically into that, Here is a link you can go through with , and which may relates to your problem .(In this solution nidhi has manged programmatically to retrieve data back)
Add word to user dictionary and retrieve them back from dictionary
In addition you can go through following links to :
http://developer.android.com/reference/android/provider/UserDictionary.html
http://developer.android.com/reference/android/provider/UserDictionary.Words.html
Moreover if you want a custom personal dictionary then manually you have to store words and retrieve them back .
Hope that helps !!!

Android application

Whenever i login to application i need to enter the password.But next time when i enter the password it shows me complete password over the soft keyboard of android.I need to clear this
data from android memory.
If you don't want the password hint to be shown try adding the following to your EditText attributes
android:inputType="textFilter|textMultiLine|textNoSuggestions"

Categories

Resources