-
Notifications
You must be signed in to change notification settings - Fork 618
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 the value in webview element #53
Comments
I will change the step so that it clears the input field before entering text. That means that if you enter an empty string it will only clear the field. |
I just released calabash-android-0.0.16. Given /^I clear the first input field$/ do
set_text "webView, css:input[type=text]", ''
end
Given /^I enter "([^"]*)" into the first input field$/ do |text|
set_text "webView, css:input[type=text]", text
end
|
Please help me understand, I am also new to cucumber. Given /^I enter "([^"])" into the input field "([^"])" $/ do |text, locator| For example:- Given I enter "abc@gmail.com" into the input field "input#email" |
This should work if you want to give the css selector as an argument.
However, it is more readable to do something like:
That way you keep your test in a business language without exposing technical details. |
Thank you . This works as desired But the below step doesn't clear the input field. I still see the old text exists in email field. I did install the latest gem and I unpacked the gem and noticed the set_text(uiquery, txt) method is defined operations.rb. |
Continuation... |
Did you update calabash-android to 0.0.17? It should clear the text field. Run |
Yes, I do have 0.0.17. The non-empty string works- The below empty string doesn't work- The step definition are defined as you described:- Given /^I enter "([^\"]*)" as email$/ do |email| |
Does this work as expected?
|
Yes, it worked. |
Just to be sure. After you you run the to steps above the input field has the value "bar", right? What about entering a single space into the field? It might have something to do with a listener on the field in your app. Do you know if there is such a listener? |
There is email-id already populated in the username field. When I enter the value "bar" then the "bar" is appended to the already existing text. When I entered a single space into the field via the step 'Given I enter " " as email' then I noticed the username field is appended with single space "abc@yahoo.com " My original request for filing this issue is to clear the content in the username field before entering a new username. I will get back to you regarding the listener. |
There seem to have been a bug in 0.0.16 so that the text is not cleared. Could you try to update to 0.0.18? |
Thanks a lot. It works after upgrading to 0.0.18. |
Hi,
I had to clear the login name in the webview and then enter the valid name.
I created a step that invokes action(key) "set_text" or "enter_text_by_selector" and passed an empty string as "". But this doesn't clear the login element.
Should there be a new action defined in instrumentation_backend to clear the value for elements in webview similar to ClearTextByIndex.java or ClearTextFieldByContentDescription.java or can the existing set_text/enter_text_by_selector action be fixed to clear the value of an element.
Thanks.
The text was updated successfully, but these errors were encountered: