1. Introduction
1.1 Robot Framework
Robot Framework is an automated functional testing framework written in Python.
- It is highly extensible and supports keyword-driven testing
- It can test several types of clients or interfaces at the same time
- It can run distributed tests
It is mainly used for acceptance testing with many rounds and for test-driven development.
1.2 Robot Framework IDE (RIDE)
Robot Framework IDE (RIDE) is the integrated development environment for the Robot Framework.
It is worth noting that, from March 12, 2016 to the present, robotframework/RIDE has had no new commits. Of course, you can try other fork versions, such as HelioGuilherme66/RIDE.
2. Installing Dependencies
- Install the Python environment
Since robotframework-ride (1.5.2.1) does not support Python 3, it is recommended to use Python 2.7. Do not forget to add the Python installation path to PATH, set path=%path%;c:\python27;c:\python27\Scripts (assuming the installation directory is c:\python27).
Go to download
- Install robot framework
| |
- Install robot framework ride
| |
- Install the necessary libraries
| |
- Install wxPython
wxPython is a cross-platform, open-source GUI toolkit implemented as a Python extension module that wraps wxWidgets.
Different versions of robotframework may depend on different versions of wxPython.
It is recommended that you first run the ride.py command in the console.
| |
Because wxPython is not installed, the terminal reports an error showing the wxPython version that the current robotframework requires.
Besides the version number, you also need to install a version matching the bitness of Python, 32-bit or 64-bit.
Use the following command to quickly determine whether the current Python version is 32-bit or 64-bit.
| |
Then go to the wxPython website or sourceforge to download the unicode version with the appropriate version number and bitness (32-bit or 64-bit), and install it to \python\Lib\site-packages.
Since installing with pip without a version number installs the latest version, what follows are my local version numbers for reference:
| |
3. Running
In any terminal, type ride.py and the RIDE interface appears.
If the above startup method reports an error, you can try going into the directory containing ride.py, python\scripts, and running python ride.py.
4. Problems and Solutions
4.1 ‘ascii’ codec can’t decode byte 0xd7
Error message:
| |
Solution:
Create a sitecustomize.py file in the Lib folder of the Python installation directory. Its contents are as follows:
| |
The default system encoding of Python is ASCII, which means Chinese paths cannot be recognized, so the default encoding must be changed to gbk (Windows) or utf8 (Linux).
4.2 python cannot found robot
robotframework depends on the robot package. However, if you installed robot before, the robotframework configuration will be wrong and robot cannot be found.
The recommended fix is to delete every package starting with robot under the python\Lib\site-packages directory, then reinstall once. This is simpler and more straightforward.
4.3 WebDriverException
Error message:
| |
Solution:
This is usually caused by a driver version that does not match the browser version, or by the driver not being found.
Go to the address given in the message, or to the Selenium driver list page, download the driver matching your local browser version, and add the driver to the PATH environment variable.
