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 ...
随机推荐
- LeetCode OJ--Search for a Range
http://oj.leetcode.com/problems/search-for-a-range/ 要求复杂度为O(lgn),用二分查找的思想. #include <iostream> ...
- loading上下左右居中
.loading { width: 50px; height: 60px; text-align: center; font-size: 10px; position:fixed; left:50%; ...
- HTML-在canvas画图中,图片的线上链接已配置允许跨域后,仍然出错提示跨域,怎么解决?
这个问题我已经遇到了2次,第一次解决了后,第二次又遇到了,所以这次做个笔记,怕以后再次遇到 举例: 1.要实现的问题:我需要在canvas画布上画上我的微信头像 2.后台配置已经完成了允许我头像地址的 ...
- FFT题集
FFT学习参考这两篇博客,很详细,结合这看,互补. 博客一 博客二 很大一部分题目需要构造多项式相乘来进行计数问题. 1. HDU 1402 A * B Problem Plus 把A和B分别当作多项 ...
- js中cookie、sessionStorage、localStorage
一.cookie <!DOCTYPE html> <html> <head> <meta charset="utf-8"> < ...
- es6系列-变量的解构赋值
git地址: https://github.com/rainnaZR/es6-study/tree/master/src/destructuring 变量的解构赋值 变量的解构赋值: 数组, 对象, ...
- POJ 1018 Communication System 题解
本题一看似乎是递归回溯剪枝的方法.我一提交,结果超时. 然后又好像是使用DP,还可能我剪枝不够. 想了非常久,无奈忍不住偷看了下提示.发现方法真多.有贪心,DP,有高级剪枝的.还有三分法的.八仙过海各 ...
- sklearn特征选择和分类模型
sklearn特征选择和分类模型 数据格式: 这里.原始特征的输入文件的格式使用libsvm的格式,即每行是label index1:value1 index2:value2这样的稀疏矩阵的格式. s ...
- 反射 type 的基本用法,动态加载插件
这里介绍反射的简单实用 MyClass类 public class MyClass { public int Age { get; set; } public string Name { get; s ...
- 非常不错的ajax原理总结
在工作中用了Ajax N多次了,也看过一些相关方面的书籍,也算是认识了它,但是一直没有认真总结和整理过相关的东东,失败!近有闲情,将之总结如下:[名称]Ajax是Asynchronous JavaSc ...