Selenium3 + python automated 016-Selenium Grid

A, Selenium Grid Introduction

1, the concept of

Selenium Grid components designed for remote distributed concurrent testing or testing can improve execution speed and efficiency of test cases by way of concurrent execution of test cases, automated test execution speed interface to solve the problem of slow

2, how can do

Use this component to multiple computers (different operating systems and different versions of the browser environment) distributed on a single computer concurrently executing multiple test cases, test case execution greatly improving the efficiency of large-scale projects to meet the basic automated testing deadlines and compatibility requirements

3, version

Version 1.0

Version 2.0, you can remotely control up to five browser

4, the operating mode

  Report using Selenium Grid Hub and Node mode, one computer as the Hub (Manager) to manage multiple other Node (node) computer, the Hub is responsible for test cases distributed to more than one computer to perform Node, Node and collect more than one computer to perform results after submitting a summary of the overall test report

4.1、Hub

1. In a distributed test mode, only one computer as Hub

2.Hub responsible for managing test scripts, and is responsible for sending the script to other Node node.

3. All Node node computer must first be registered on the computer as the Hub, the registration is successful then and computer communications Hub, Hub Node node computer will tell their related information, such as operating system and browser Node node related version

4.Hub computer can execute test cases to their assigned tasks

Test Case Task 5.Hub computer distribution will be performed at various computer nodes Node

 

4.2、Node

1. In a distributed test mode, there may be one or more nodes Node

2.Node node will open the local browser to complete testing tasks and return the results to the Hub

Operating system and browser version 3.Node node does not need to be consistent and Hub

4. The browser can open multiple tasks simultaneously performed in parallel on a test node Node

 

Two, Selenium Grid use

2.1, the test environment preparation

1, download JDK 1.8, the installation and configuration environment variable bin

2, Hub Node computers and computer are accessible http://www.seleniumhq.org/download

jar file selenium-server-standalone-x.xxx.xx.jar Download 'Selenium Standalone Server' in

 

3, open the CMD window on the Hub computer, the current working directory to the directory where the jar file, execute: java -jar selenium-server-standalone-3.141.59.jar -role hub

(-Role hub: Hub start a service, as a distributed management center, waiting WebDriver client to register and request, receive a registration default address is http: // localhost: 4444 / grid / register, start the default port 4444)

4, Firefox browser to http Hub computer: // localhost: 4444 / grid / console, display links 'view config' page if accessed, that can access the secondary site. Locahost speaking native of real change ip still be a normal visit

 

5, Node computer, open the CMD window, the current working directory to the directory where the jar file, execute: the Java -jar the Selenium-Server-Standalone-3.141.59.jar -role webdriver -hub http://192.168.1.7:4444 / Grid / Register -port 6655 -browser BrowserName = 'Chrome' (or: browserName = 'firefox' or -browser browserName = 'ie')

(1) role: webdriver represents the name of the parameter value Node (node)

(2) hub: parameter value represents the URL address management center, Node node will link the address register

(3) port: the port number parameter value of the service node Node 6655 is recommended port number greater than 5000

 

6, another visit http://192.168.1.10:4444/grid/console, verify Node node has been successfully registered in the Hub, registration success as shown in the figure.
From this page you can get to the node computers allow different kinds of browser how many instances of open, verify the correctness of the node computer to execute the command line.

 

2.2, write test scripts distributed execution

1, using the chrome browser to access the Baidu home page, enter the keyword 'selenium' to search, verify that the search results page contains the source code 'selenium' keyword.

2, execute scripts, Node computer automatically starts the browser chrome test script execution, after the implementation of the results of automated testing can be seen in the Hub computer.

 

Guess you like

Origin www.cnblogs.com/liunaixu/p/11200087.html