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 ...
随机推荐
- hdu 1250(大整数)
Hat's Fibonacci Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)T ...
- Oracle For 循环添加数据
自己亲自使用的,绝对OK --添加数据declare i number; --用for实现 begin for i in 0 .. 500 loop insert into cust(custsn,t ...
- 初识mysql语句
操作文件夹(库) 增 create database db1 charset utf8; 查 # 查看当前创建的数据库 show create database db1; # 查看所有的数据库 sho ...
- react-native初始化项目的时候安装失败,如何解决【摘】
首先初始化项目报错: 解决方法: 将这个版本号改为: 然后将这里: 改为: 版本号相对应 然后便可安装成功! [注:转载:https://blog.csdn.net/wwrzyy/article/ ...
- Java 实现随机验证码
许多系统的注册.登录或者发布信息模块都添加的随机码功能,就是为了避免自动注册程序或者自动发布程序的使用. 验证码实际上就是随机选择一些字符以图片的形式展现在页面上,如果进行提交操作的同时需要将图片上的 ...
- Netty学习_Netty框架入门教程:Netty入门之HelloWorld实现
我们可能都学过Socket通信/io/nio/aio等的编程.如果想把Socket真正的用于实际工作中去,那么还需要不断的完善.扩展和优化.比如很经典的Tcp读包写包问题,或者是数据接收的大小,实际的 ...
- 预防SQL注入笔记
SQL注入如何预防? 本文参考自owasp,重点是提供清晰,简单,可操作的指导,以防止应用程序中的SQL注入漏洞.不幸的是,SQL注入攻击很常见,这是由于两个因素: SQL注入漏洞的显着流行 目标的吸 ...
- eclipse代码不能自动提示的问题解决
步骤如下:window->Preferences->Java->Editor->content assist 替换输入成: 普通:[.abcdefghijklmnopqrstu ...
- 邁向IT專家成功之路的三十則鐵律 鐵律十:IT人思維之道-跳脫框架
莊子的哲學思想歸本於老子,他認為人要解脫束縛必須做到不從任何的角度與任何的時間來看待事物,而是必須與天地同體,然而也唯有如此才能看清宇宙間萬事萬理的真諦.無論是莊子還是老子,他們畢竟是中國古代的聖賢, ...
- 终极报错解决方案:Error:Execution failed for task ':app:processDebugManifest'. > Manifest merger failed with
遇到这个报错的时候,不要慌 Error:Execution failed for task ':app:processDebugManifest'. > Manifest merger fail ...