Multi-lingual Support
Multi-lingual Support
One problem with dealing with non-Latin characters programmatically is that, for characters with accents, there can be multiple ways of encoding the form. So, for the letter é
, there are two encodings: a single combining character é
(Unicode’s LATIN SMALL LETTER E WITH ACUTE
), and the combination of the letter e
followed by the accent, ́
(COMBINING ACUTE ACCENT
). In order to deal with this, there is normalization
, an operation that makes “equivalent strings have a unique binary representation”.//一个编码问题,é
可以有多种表示方式。
Luckily, normalizing ASCII text (i.e., text that doesn’t need to be normalized) does not cause any changes, and performing the operation multiple times does not have an effect. Thus a normalization function can be called on text without risking adverse effects.
So, when dealing with unicode text within a test, you need to normalize, preferably on both the text expected and that received from Appium. There are a number of ways to do the normalization, so be sure to perform the same operation on both strings!//期待结果和实际结果要用同一种方式解码编码。
One tell-tale sign that the problem is with the encoding of the unicode text is an assertion that fails but reports what look to be the same string:
AssertionError: expected 'François Gérard' to deeply equal 'François Gérard'
+ expected - actual
+"François Gérard"
-"François Gérard"
Since the error is just encoding, the output looks the same. Normalized, these should equal programmatically as well as visually.//如果期待结果与实际结果一致,但是断言却失败了,那么说明编码问题了。
Finders
Finding by text can also require normalization. For instance, if you have a button in an iOS app with the name Найти
you may need to normalize the text within the find command.//使用文本查找元素时,需要将文本解码编码进行规范化。
Otherwise the elements may not be found.
Text Fields
By default the automation tools for both iOS and Android do not support non-ASCII characters sent to editable fields through the keyboard.//默认情况下,iOS和安卓都不支持使用keyboard输入非ASCII字符。
iOS
Appium sends non-ASCII characters to iOS editable fields directly, bypassing the keyboard altogether. While this allows the text to be inputted in tests, it should be kept in mind that any business logic triggered by keyboard input will therefore not be tested.//iOS绕开keyboard输入非ASCII字符。
As above, the text received may need to be normalized before asserting on it.
Android
Android tests allow for Unicode input by installing and using a specialized keyboard that allows the text to be passed as ASCII text between Appium and the application being tested.//安卓需要安装一个特殊的键盘软件,用于输入Unicode字符,如同输入ASCII字符一般。使用时,还要将unicodeKeyboard和resetKeyboard两个参数配置为true。使用send_keys方法输入Unicode字符。
In order to utilize this functionality, set the unicodeKeyboard
desired capability is set to true
. If the keyboard should be returned to its original state, the resetKeyboard
desired capability should also be set to true
. Otherwise Appium’s Unicode keyboard will remain enabled on the device after the tests are completed.
Then tests can pass Unicode text to editable fields using send_keys
.
Multi-lingual Support的更多相关文章
- English word
第一部分 通过词缀认识单词 (常用前缀一) 1.a- ①加在单词(形容词)或词根前面,表示"不,无,非" acentric [ə'sentrik] a 无中心的(a+centr ...
- Best Open Source Software
Best Open Source Software Open Source, Software, Top The promise of open source software is best qua ...
- Theano2.1.1-基础知识之准备工作
来源:http://deeplearning.net/software/theano/tutorial/index.html#tutorial 这里介绍的是使用theano的一些基础知识,虽然thea ...
- Theano2.1.21-基础知识之theano中多核的支持
来自:http://deeplearning.net/software/theano/tutorial/multi_cores.html Multi cores support in Theano 一 ...
- Coordinate System
Coordinate System Introduction of Different Coordinate Systems Cartesian Coordinate System UI Coordi ...
- Herriot
Herriot测试框架是Hadoop-0.21.0及以后版本中新加入的测试框架,它的出现主要是为了尽可能地模拟真实的大规模分布式系统,并且对该系统实现自动化测试.和Hadoop以前的测试框架MiniD ...
- SSL加速卡调研的原因及背景
SSL加速卡调研的原因及背景 SSL加速卡调研的原因及背景 网络信息安全已经成为电子商务和网络信息业发展的一个瓶颈,安全套接层(SSL)协议能较好地解决安全处理问题,而SSL加速器有效地提高了网络安全 ...
- 实现text-detection-ctpn一路的坎坎坷坷
小编在学习文字检测,因为作者提供的caffe实现没有训练代码(不过训练代码可以参考faster-rcnn的训练代码),所以我打算先使用tensorflow实现,主要是复现前辈的代码,主要是对文字检测模 ...
- Goslate: Free Google Translate API
Python爬虫视频教程零基础小白到scrapy爬虫高手-轻松入门 https://item.taobao.com/item.htm?spm=a1z38n.10677092.0.0.482434a6E ...
- activate-power-mode 插件 安装 设置 IDEA
作者:韩梦飞沙 Author:han_meng_fei_sha 邮箱:313134555@qq.com E-mail: 313134555 @qq.com 可用 摇 shake 粒子 particle ...
随机推荐
- UVA - 10050 Hartals
#include <cstdio> #include <cstring> ]; ]; int main() { int t; scanf("%d", &am ...
- TStringList,快速解析 查找测试。。。很有用,再也不用 FOR 循环了
aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAABKAAAALHCAIAAAA2Gq0zAAAgAElEQVR4nOydeVgUV76wK5OZb5JJZi
- GNOME 3.x下安装配置小企鹅输入法框架及SunPinYin插件
fcitx 小企鹅输入法框架已经越来越成熟,并且具备极高的性能,配合 Sun PinYin 智能输入法就和 Windows 下的搜狗百度等输入法几乎无二了.事实上,现在Linux版本的搜狗输入法正是基 ...
- hdu 1401(单广各种卡的搜索题||双广秒速)
Solitaire Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total S ...
- react native 添加mobx
"babel-plugin-transform-decorators-legacy": "^1.3.5", "babel-preset-react-n ...
- 饼系列—圈饼 doughnut
chartControl属性 ApplicationSettings: Name:控件名字 AccessibleDescription: ??? AccessibleName:??? Accessib ...
- 怎样在ubuntu 系统上为 php 加上 redis 扩展
近期一个项目.,想用redis 作为数据库,php是不待redis 扩展,必须安装,怎么安装呢?我在网上找的非常多资料发现都是预编译的.但都没成功.于是就找了第二种方法是不须要编译直接安装就能够了. ...
- Neural Networks for Machine Learning by Geoffrey Hinton (1~2)
机器学习能良好解决的问题 识别模式 识别异常 预測 大脑工作模式 人类有个神经元,每一个包括个权重,带宽要远好于工作站. 神经元的不同类型 Linear (线性)神经元 Binary thresho ...
- angular - 使用es6等一些功能
app.module.ts var model = { user: 'Admin', items: [{ action: 'buy flowsers', done: false },{ action: ...
- 使用Golang利用ectd实现一个分布式锁
http://blog.codeg.cn/post/blog/2016-02-24-distrubute-lock-over-etcd/ By zieckey · 2016年02月24日 · 1205 ...