Robot Framework uses PHANTOMJS for interface-Free UI Automation testing

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.