AndroidViewClient icon indicating copy to clipboard operation
AndroidViewClient copied to clipboard

view.type(str) too slow

Open gdobra opened this issue 12 years ago • 4 comments

view.type() is too slow just because it types every single character using a different 'adb shell input text' on each character contained in str. And that's done this way because adb input text won't accept space. So, instead of calling adb for each and every character, you could replace " " with "%s" and do the input in one go.

instead of: for c in str: device.type(c)

we could write: str = str.replace(" ", "%s") device.type(str)

gdobra avatar Nov 25 '13 19:11 gdobra

Good point

dtmilano avatar Nov 27 '13 06:11 dtmilano

Of course, it's worth escaping the %s whenever that's exactly what the user wants to type in, in order not to be replaced by a space in the input text. So a review of adb's escape sequences would help do the job correctly.

gdobra avatar Nov 27 '13 10:11 gdobra

Sorry, I didn't quite understand you last comment. Do you have some examples?

On Wed, Nov 27, 2013 at 5:21 AM, gdobra [email protected] wrote:

Of course, it's worth escaping the %s whenever that's exactly what the user wants to type in, in order not to be replaced by a space in the input text. So a review of adb's escape sequences would help do the job correctly.

— Reply to this email directly or view it on GitHubhttps://github.com/dtmilano/AndroidViewClient/issues/72#issuecomment-29373624 .

Have you read my blog ? http://dtmilano.blogspot.com android junit tests ui linux cult thin clients

dtmilano avatar Nov 29 '13 03:11 dtmilano

well, if I really want to input "%s" that should be escaped as "%s" or something. So, if my text is "this is %s", that should be modified as "this%sis%s%s"

gdobra avatar Dec 05 '13 17:12 gdobra