在send_keys函数中使用emojis时出现selenium抛出错误

时间:2016-10-05 12:43:57

标签: python selenium unicode encoding utf-8

我正在尝试使用send_keys填充我网站上的表单。 但是,每当我尝试传递这样的表情符号时:

''.decode('utf-8')

我会遇到以下错误:

selenium.common.exceptions.WebDriverException: Message: missing command parameters

这应该可以在每个python 2.7安装上复制。

如此定义编码:#encoding=utf-8不会改变任何内容,错误仍然存​​在。

我做错了什么?如何将send_keys与emojis结合使用?

编辑:

现在将字符串更改为u''.encode('utf-8')并添加# -*- coding: utf-8 -*-错误:UnicodeDecodeError: 'utf8' codec can't decode byte 0xf0 in position 0: unexpected end of data

0 个答案:

没有答案