def assert_element_in_page_source(s):
print type(s)
print s
#assert s in driver.page_source
command='assert_element_in_page_source(u"退出")'
print "type(command)",type(command)
eval(command)

 

执行脚本文件。报错如下错误,没找到原因,后续调查

D:\test>python test.py
ascii
type(command) <type 'str'>
<type 'unicode'>
Traceback (most recent call last):
File "test.py", line 85, in <module>
eval(command)
File "<string>", line 1, in <module>
File "test.py", line 81, in assert_element_in_page_source
print s
UnicodeEncodeError: 'gbk' codec can't encode character u'\x80' in position 1: illegal multibyte sequence

相关文章:

  • 2022-12-23
  • 2021-09-11
  • 2021-07-29
  • 2021-11-08
  • 2021-11-05
  • 2021-09-25
  • 2021-09-06
  • 2021-12-06
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-07-26
  • 2022-12-23
  • 2021-07-28
  • 2021-06-19
相关资源
相似解决方案