Code Monkey home page Code Monkey logo

robot's Introduction

一、环境安装

1、安装Python2.7和pip https://pypi.python.org/pypi/pip#downloads
2、安装Library
pip install robotframework  (VERSION = '2.9.1')
pip install robotframework-httplibrary(VERSION = '0.4.2')
pip install requests  (VERSION = '2.9.1')
pip install robotframework-requests (VERSION = '0.3.8')
pip install robotframework-databaselibrary
pip install PyMySQL
3、安装wxPython2.8-win32-unicode-2.8.12.1-py27.exe
4、安装robotframework-ride-1.2.3.win32.exe
5、引用库
Library HttpLibrary.HTTP
Library RequestsLibrary
Library Collections
Library DatabaseLibrary
Library json

二、遇到的问题和解决方式

1、测试报告乱码问题(Windows系统中存在,Linux中正常)
修改C:\Python27\Lib\site-packages\robot\utils\encodingsniffer.py  
修改前:
DEFAULT_SYSTEM_ENCODING = 'cp125'
DEFAULT_OUTPUT_ENCODING = 'cp437'
修改后:
DEFAULT_SYSTEM_ENCODING = 'cp936'
DEFAULT_OUTPUT_ENCODING = 'cp936'
2、HttpLibrary 发送http请求报错,ascii codec can't decode byte 0xe8 in position 0:ordinal not in range(128)
修改HttpLibrary类库的init.py ,添加如下:
import sys
reload(sys)
sys.setdefaultencoding('utf-8')

3、解决 requestlibrary  tojson  中文无法正常显示的问题
    修改  添加参数 ensure_ascii=False,
     def _json_pretty_print(self, content):
        """ Pretty print a JSON object
        'content'  JSON object to pretty print
        """
        temp = json.loads(content)
        return json.dumps(
            temp,
            ensure_ascii=False,
            sort_keys=True,
            indent=4,
            separators=(',',': ')
        )

robot's People

Contributors

521pengzhou avatar zhoupengkobe avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.