中文注释无法在机器人框架中的RIDE中正确显示

时间:2017-04-28 06:35:31

标签: robotframework robotframework-ide

我在Robot Framework的自定义库中定义了一个函数:

def close_browser(self):
    '''
    description: 关闭当前浏览器
    params:
        None
    return:
        None
    '''
    self.driver.quit()

但是当我在RIDE中搜索该函数时,该函数的注释显示如下:

  

description:\ xb9 \ xd8 \ xb1 \ xd5 \ xb5 \ xb1 \ xc7 \ xb0 \ xe4 \ xaf \ xc0 \ xc0 \ xc6 \ xf7 params:无返回:无

中文显示unicode,有谁知道为什么会这样? enter image description here

1 个答案:

答案 0 :(得分:2)

在自定义库标题中声明此内容

# -*- coding: utf-8 -*-

大部分看起来像

# -*- coding: utf-8 -*-


class aaMyLibrary:
    def stackover(self):
        '''
        description: 关闭当前浏览器
        params:
            None
        return:
            None'''
        self.driver.quit()

会结果 this