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

How could I using unicodeKeyboard to input sentences. #242

Open
QingXiangBaiLian opened this issue Apr 16, 2018 · 4 comments
Open

How could I using unicodeKeyboard to input sentences. #242

QingXiangBaiLian opened this issue Apr 16, 2018 · 4 comments

Comments

@QingXiangBaiLian
Copy link

With appium, I can using unicodeKeyboard to type and send Chinese sentences, like below, but I'm not sure AndroidViewClient has similar function
desired_caps["unicodeKeyboard"] = True desired_caps["resetKeyboard"] = True driver = webdriver.Remote('http://127.0.0.1:4723/wd/hub', desired_caps) driver.find_element_by_id("id/text_input").send_keys(question)

@dtmilano
Copy link
Owner

I'm not sure about your intentions, but I understand you want to enter Chinese text into an EditText or something like that.

As an example, I'm using Calendar and creating a Reminder.

screen shot 2018-04-16 at 12 38 32

you can enter unicode text and then the corresponding code will be generated.

screen shot 2018-04-16 at 12 42 28

You need AndroidViewClient >= 15.2.1 for this to work correctly.

The generated line in this case is

self.vc.uiAutomatorHelper.findObject(
 
 bySelector='[email protected]:id/title_edit_text,[email protected],text@$Remind me to…,[email protected]')
    .setText("提醒我包括中文支持")

@QingXiangBaiLian
Copy link
Author

Very thanks, it's do a solution to input Chinese text ! However, as I can't using uiAutomatorHelper (Culebra Tester always show "Instrumentation not installed" on the bottom, although I have already installed the Instrumentation), I'm now using viewserver, and detect the input element via findViewByIdOrRaise, then using type method to enter Chinese as below, but it doesn't work, have you any ideas? This method seems only support English.
editE = vc.findViewByIdOrRaise("id/EditText_id") editE.type(u"中文")
I'm very sorry for boring you so much. As I'm a ML algorithm Eng. and know almost nothing about Android, but my leader give me this task for the staff shortage problem in our team.

@dtmilano
Copy link
Owner

Culebra Tester always show "Instrumentation not installed" on the bottom, although I have already installed the Instrumentation)

Are you 100% sure you have both APKs installed?
As described at https://github.com/dtmilano/CulebraTester-public/wiki/Getting-started.

If so, and still detecting "Instrummentation not installed", can you please provide logcat so we can determine the problem.

ViewServer is very old an a lot of things won't be supported. In such cases AdbClient gives

warnings.warn(u"WARNING: 'input text' utility does not support unicode: %s" % text)

when unicode text is detected in an argument.
The limitation is in the underlyig utility input text, so the solution is outside AndroidViewClient/culebra.

My recommentdation: stick to uiAutomatorHelper which is the best option by far.

'm very sorry for boring you so much. As I'm a ML algorithm Eng. and know almost nothing about Android, but my leader give me this task for the staff shortage problem in our team.

Hope you enjoy the ride. You'll be glad to hear then, that shortly, CulebraTester will "learn" how to test Android apps automatically, most like concertina mode but AI based.

@jigaowan
Copy link
Contributor

jigaowan commented May 2, 2018

use this
https://github.com/senzhk/ADBKeyBoard

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants