Python+selenium Automated Software Testing (5th): Selenium gird

Source: Internet
Author: User
Tags selenium grid

5.1 Distributed (Grid)

The Selenium grid is a tool for distributing test case scripts, such as testers who often test for multi-browser compatibility, and then use the grid. Here's how to run the same script on multiple browsers.
Files required to use the grid: 1. Selenium server (i.e. Selenium-server-standalone-x.xx.x.jar); 2.grid configuration file (which is responsible for providing host and browser information); 3. Test the script.
First, take a look at the contents of the grid configuration file:
def grid (): d={' http://127.0.0.1:4444/wd/hub ': ' Firefox ', ' Http://127.0.0.1:5555/wd/hub ': ' Internet Explorer ', } return D
The file defines a method that stores a dictionary that assigns 2 different ports to the machine and specifies a different browser (4444 is the default port for the grid hub, and 5555 is a node port, which is described later).
Second, take a look at the test script:

The script is to write a Baidu search keyword and made a simple assertion of the script, the import of Grid_module is the first step in the grid configuration file, the loop body is written from the dictionary to remove the host name and browser name assigned to the following parameters, In this case, the test script will call the local 2 specified browsers and run.
3. Then the server is restarted and the corresponding version of Selenium server is downloaded from http://selenium-release.storage.googleapis.com/index.html:

After downloading it, open cmd, enter Java-jar selenium-server-standalone-x.xx.x.jar-role hub, this is the root of all evils, start it before you can do the things behind. After startup, open a cmd, enter Java-jar selenium-server-standalone-x.xx.x.jar-role node-port 5555, which is the first node to start, specify Port 5555, Consistent with the ports written in the grid configuration file.
When hub and node start up, we enter http://127.0.0.1:4444/grid/console in the browser to open the grid's console:

We can see that a node with a port of 5555 has started up, and the IP here is the native IP.

Python+selenium Automated Software Testing (5th): Selenium gird

Related Article

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.