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的更多相关文章

  1. English word

    第一部分  通过词缀认识单词 (常用前缀一) 1.a- ①加在单词(形容词)或词根前面,表示"不,无,非" acentric [ə'sentrik] a  无中心的(a+centr ...

  2. Best Open Source Software

    Best Open Source Software Open Source, Software, Top The promise of open source software is best qua ...

  3. Theano2.1.1-基础知识之准备工作

    来源:http://deeplearning.net/software/theano/tutorial/index.html#tutorial 这里介绍的是使用theano的一些基础知识,虽然thea ...

  4. Theano2.1.21-基础知识之theano中多核的支持

    来自:http://deeplearning.net/software/theano/tutorial/multi_cores.html Multi cores support in Theano 一 ...

  5. Coordinate System

    Coordinate System Introduction of Different Coordinate Systems Cartesian Coordinate System UI Coordi ...

  6. Herriot

    Herriot测试框架是Hadoop-0.21.0及以后版本中新加入的测试框架,它的出现主要是为了尽可能地模拟真实的大规模分布式系统,并且对该系统实现自动化测试.和Hadoop以前的测试框架MiniD ...

  7. SSL加速卡调研的原因及背景

    SSL加速卡调研的原因及背景 SSL加速卡调研的原因及背景 网络信息安全已经成为电子商务和网络信息业发展的一个瓶颈,安全套接层(SSL)协议能较好地解决安全处理问题,而SSL加速器有效地提高了网络安全 ...

  8. 实现text-detection-ctpn一路的坎坎坷坷

    小编在学习文字检测,因为作者提供的caffe实现没有训练代码(不过训练代码可以参考faster-rcnn的训练代码),所以我打算先使用tensorflow实现,主要是复现前辈的代码,主要是对文字检测模 ...

  9. Goslate: Free Google Translate API

    Python爬虫视频教程零基础小白到scrapy爬虫高手-轻松入门 https://item.taobao.com/item.htm?spm=a1z38n.10677092.0.0.482434a6E ...

  10. activate-power-mode 插件 安装 设置 IDEA

    作者:韩梦飞沙 Author:han_meng_fei_sha 邮箱:313134555@qq.com E-mail: 313134555 @qq.com 可用 摇 shake 粒子 particle ...

随机推荐

  1. LeetCode OJ--Rotate List

    http://oj.leetcode.com/problems/rotate-list/ 取得后面k个节点,然后截断插到前面.如果k比list长,则按照求余算. 去后面的k个节点:使用两个指针,第一个 ...

  2. Redis实用监控工具一览

    Redis已经成为web应用开发不可或缺的一个组成部分,在项目中的应用越来越广泛,这篇文章就来讲讲那些关于Redis监控的那点事. vredis-benchmark 1.1 简介 第一个就介绍一下,R ...

  3. 分享Kali Linux 2017年第11周镜像文件

     分享Kali Linux 2017年第11周镜像文件 Kali?Linux官方于3月12日发布2017年的第11周镜像.这次维持了11个镜像文件的规模.默认的Gnome桌面的4个镜像,E17.KDE ...

  4. python装饰器的深度探究

    1.讲装饰器一般讲到这种代码就可以了,但这篇博客会介绍更多: def deco(func): def wrapper(): print("start") func() #调用函数 ...

  5. interesting-exploit

    http://whereisk0shl.top/cve-2017-7269-iis6-interesting-exploit.html

  6. remove xcode recent projects from dock menu 移除xcode dock菜单显示的项目列表

    Launch Xcode Select File->Open Recent->Clear Menu Right-click the Xcode icon and select Show A ...

  7. socket阻塞与非阻塞,同步与异步I/O模型

    作者:huangguisu 原文出处:http://blog.csdn.NET/hguisu/article/details/7453390 socket阻塞与非阻塞,同步与异步 1. 概念理解 在进 ...

  8. Linux以下基于TCP多线程聊天室(server)

    接上篇博文,本文是server端的实现,主要实现的功能,就是现实client的连接.转发client发送的消息.以及client掉线提示等功能,同一时候能够在这这上面扩展和TCP以及线程相关的功能木块 ...

  9. c++程序猿经典面试题(2)

    1.以下程序的输出结果是? #include<stdio.h> main(){ int b=3; int arr[]={6,7,8,9,10}; int *ptr=arr; *(ptr++ ...

  10. Android MPAndroidCharts 框架 画可滑动查看的直方图

    1.由于公司项目的需求,所以花了1.2天研究 MPAndroidCharts框架 .可是发现好多博客对我都没得帮助.浪费非常多时间在百度上.不得不说google 真是比百度强太多了. 要求:统计出56 ...