The Robot framework is a keyword-driven acceptance automation testing framework that is now being used more and more widely in China. A common test solution for Web UI Automation is Robot Framework+selenium2library (RFS). In general, to use the Selenium2library library, you must configure the browser driver (driver). Otherwise, you will not be able to drive the browser to execute Automation commands.
Browser Driver Correspondence table
The above table briefly describes the drivers that are required for different browsers. Here we focus on how to test without UI Automation based on RFS+PHANTOMJS.
PHANTOMJS Environment Installation First step: Install RFS Environment
It is recommended to install with PIP, other installation methods are not introduced.
> pip install -U robotframework-selenium2library
Installing the Selenium2library library automatically installs its dependent library robot Framework.
Step Two: Configure the PHANTOMJS execution environment
Download Phantomjs First, you can download the version of Windows, or you can download the Linux version.
Here we describe the configuration of the Windows version.
Go to the official website http://phantomjs.org/download.html download the corresponding release package.
After the download is complete, compress the package and place it under any path , such as D:\browser.
PHANTOMJS Path
Next, Configure the system environment variable to add the D:\browser to the system environment variable path.
Configuring Environment variables
At this point, we have configured the PHANTOMJS execution environment. You can enter commands on the console phantomjs.exe --version
to verify that the configuration is correct.
PHANTOMJS version
The version number is correctly printed, indicating that the configuration was successful.
Use case execution
Ok, next, we will validate the RFS+PHANTOMJS UI Automation test function with a simple test case.
Write the robot framework test case Phantomjs_test.robot.
Robot Framework Test Case
To execute a test case:
> robot phantomjs_test.robot
Test results
As we can see, the test cases are executed correctly, consistent with the results of chrome-based execution.
Wywincl
Links: http://www.jianshu.com/p/ba30ed33076a
Source: Pinterest
Copyright belongs to the author. Commercial reprint please contact the author for authorization, non-commercial reprint please specify the source.
Robot Framework uses PHANTOMJS for UI Automation testing without interfaces