如何发送“特殊字符"使用 Python 操作 Send_keys? [英] How to send "special characters" with Python Actions Send_keys?

查看:68
本文介绍了如何发送“特殊字符"使用 Python 操作 Send_keys?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在用 Python 3.7 编写代码,用于在 Appium 中测试应用程序.

I am making a code in Python 3.7 for testing an application in Appium.

我正在尝试在应用程序的输入字段中发送文本.文本为法语,带有特殊字符(é、è、à 等).

I am trying to send a text in an input field of an application. The text is in French with special characters (é, è, à, etc.).

我的代码设法逐个字符地输入,但是当它输入带有重音é"的特殊字符时,它会出错!这是错误信息:

My code managed to type character by character, one by one, but when it arrives to a special character with accent "é", it bugs! Here is error message:

Encountered internal error running command: io.appium.uiautomator2.common.exceptions.InvalidArgumentException: KeyCharacterMap.getEvents is unable to synthesize KeyEvent sequence out of '233' key code. Consider applying a patch to UiAutomator2 server code or try to synthesize the necessary key event(s) for it manually

我阅读了文档和论坛并添加了此功能:

I read the doc and forum and I added this capability:

desired_caps['unicodeKeyboard'] ='true'

但它并没有改变任何东西.我仍然有同样的问题.

But it didn't change anything. I still have same issue.

推荐答案

true 更改为 True<代码>required_caps['unicodeKeyboard'] ='True'

这可能对你有帮助

http://appium.io/docs/en/编写-运行-appium/other/unicode/

这篇关于如何发送“特殊字符"使用 Python 操作 Send_keys?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆