Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clear sometimes fails #3478

Closed
bootstraponline opened this issue Aug 25, 2014 · 16 comments
Closed

Clear sometimes fails #3478

bootstraponline opened this issue Aug 25, 2014 · 16 comments
Labels
Android related to Android-native driver(s) Bug a problem that needs fixing

Comments

@bootstraponline
Copy link
Member

#3367 /cc @boulevardaed

@boulevardaed
I'm using v1.2.2 (REV cf6ff5939ddc6b4d45fcbabfbfe13c950e0058c4). Here's what I found now:

Test case:
two edittexts. The first contains hinted words: "email", the second contains hinted words: "url", with pre-filled text www.123.com.
I need to input "123@456.com" in the first edittext and add /456 into the second one.

My code:
edittext1.sendKeys("123@456.com");
edittext2.clear();
edittext2.sendKeys("www.123.com/456");

Current result:
The first line: email123@456.com
The second line: blank with hinted text: url

Log of clear() part:
info: --> POST /wd/hub/session/7205a5d5-c130-4426-9d0c-8a6e845f2516/element/4/clear {"id":"4"}
info: [debug] Pushing command to appium work queue: ["element:clear",{"elementId":"4"}]
info: [debug] [BOOTSTRAP] [debug] Got data from client: {"cmd":"action","action":"element:clear","params":{"elementId":"4"}}
info: [debug] [BOOTSTRAP] [debug] Got command of type ACTION
info: [debug] [BOOTSTRAP] [debug] Got command action: clear
info: [debug] [BOOTSTRAP] [debug] Updating class "class com.android.uiautomator.core.UiDevice" to enable field "mUiAutomationBridge"
info: [debug] [BOOTSTRAP] [debug] Updating class "class com.android.uiautomator.core.UiAutomatorBridge" to enable field "mInteractionController"
info: [debug] [BOOTSTRAP] [debug] Updating class "class com.android.uiautomator.core.UiDevice" to enable field "mUiAutomationBridge"
info: [debug] [BOOTSTRAP] [debug] Updating class "class com.android.uiautomator.core.UiAutomatorBridge" to enable field "mInteractionController"
info: [debug] [BOOTSTRAP] [debug] Finding methods on class: class com.android.uiautomator.core.InteractionController
info: [debug] [BOOTSTRAP] [debug] Finding methods on class: class com.android.uiautomator.core.InteractionController
info: [debug] [BOOTSTRAP] [debug] Finding methods on class: class com.android.uiautomator.core.InteractionController
info: [debug] [BOOTSTRAP] [debug] Clearing text not successful using selectAllDelete now trying to send delete keys.
info: [debug] [BOOTSTRAP] [debug] Finding methods on class: class com.android.uiautomator.core.UiAutomatorBridge
info: [debug] [BOOTSTRAP] [debug] Clearing text not successful falling back to UiAutomator method clear
info: [debug] [BOOTSTRAP] [debug] Returning result: {"value":"Clear text not successful.","status":13}
info: [debug] Responding to client with error: {"status":13,"value":{"message":"An unknown server-side error occurred while processing the command.","origValue":"Clear text not successful."},"sessionId":"7205a5d5-c130-4426-9d0c-8a6e845f2516"}
info: <-- POST /wd/hub/session/7205a5d5-c130-4426-9d0c-8a6e845f2516/element/4/clear 500 16616.424 ms - 195

I know it's hard to fix after so many tries.. Thanks for your effort.
@bootstraponline
Copy link
Member Author

@boulevardaed what type of Android device are you using? Is it an emulator? What API level / device model?

@austenke
Copy link
Contributor

Clear is working fine, the problem is that it doesn't clear the hint text, and so when sendKeys runs .getText it sees the hint text and thinks clear failed.

@bootstraponline
Copy link
Member Author

With the new API the code should be like this instead of sendKeys/clear.

edittext1.setText("123@456.com");
edittext2.setText("www.123.com/456");

@Songroid
Copy link

Is setText a WebElement method? How can I use this method under Java? I cannot find the method.

@bootstraponline
Copy link
Member Author

@Songroid
Copy link

@bootstraponline Thanks. I will give you an update if the method is implemented.

@Songroid
Copy link

Songroid commented Sep 2, 2014

Here's what I found using the latest commit:

  1. For blank edittext with hint, when I use sendKeys(), the hint text is included.
  2. For edittext with both hint and pre-filled text, when I use sendKeys() (no clear first), the pre-filled text is included.
  3. If the pre-condition is the same with 2, when I use clear() first and then sendKeys(), nothing is input on the edittext and the test case failed immediately.

@bootstraponline
Copy link
Member Author

Unfortunately this is still broken. should be resolved in 1.2.3.

@Songroid
Copy link

Songroid commented Sep 2, 2014

@bootstraponline Can I have the ticket number to track?

@bootstraponline
Copy link
Member Author

@boulevardaed sure, it's #3526

@kingangelTOT
Copy link

android.widget.EditText is 1000000000 and clear it failed; after clear,it is 0;

@kingangelTOT
Copy link

devices is samsung note3

@hiteshgupta33
Copy link

Any update on this. I am using Appium 1.4.8 (ruby)and clear and send_keys still doesn't seem to work at all

@bootstraponline
Copy link
Member Author

This will be addressed in the new Android backend. Unfortunately there's not a great solution for the existing backend.

@bloomm09
Copy link

bloomm09 commented Jun 7, 2016

Just curious, has this issue seen any progress/update?

@lock
Copy link

lock bot commented Apr 29, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked and limited conversation to collaborators Apr 29, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Android related to Android-native driver(s) Bug a problem that needs fixing
Projects
None yet
Development

No branches or pull requests

6 participants