Deep and automated testing - Basics of Selenium RC and web Driver implementation principle

 Today, things began to write automated, it could be interspersed with other things, so in order to comply with the various stages of testing lovers. Today we began to talk about things related to automated testing. Today to talk about the principle.

  Selenium RC implementation principle, I will find a chart on the network as follows:

 

 

 

  We can clearly see, in short, is our first programming language, written control procedures, and then to control the browser by Remote Control Server, according to its own written procedures to perform. We can see, selenium supports many languages, java, Ruby, Python, PHP, etc., you can choose any language you like.

  Here we look at the steps selenium1:

  1. Test Engineer edited the test script.

  2. Execute the script.

  3. Test script sends Http request to visit the site of the middleware Remote Control Sever (referred to as RC)

  4.RC received a request to obtain access to the site content, and insert the Selenium Core JavaScript code libraries in a Web page and then return to perform the test browser.

  5. test scripts within the browser and then call the Selenium Core test code logic, and finally record test results, complete the test.

 

Everyone seems to have found a problem, that is why there Step 4? This is because the core selenium1 tool is based on the realization of javascript code library, and the library is also a separate test site, URL javascript and test site's domain name will be inconsistent, can not be automated testing, in order to bypass the browser installed selenium1 mechanism with the agency to resolve this issue.

It comprises the following steps:

  1. Execute scripts, selenium Server initiates a request.

  2. The selenium Server Launcher launch the browser, and insert selenium Core of Javascript code base, this time the browser proxy settings for Http Proxy selenium Server's. Http Proxy JS send commands that allow selenium Core to perform operations browsers. And page actions command established.

  3. The browser receives the information, then sends Http request to Http Proxy, request a new web page.

  4. Set the browser when selenium Server launch a browser to access a proxy address Http Proxy selenium Server, so Selenium Server will accept all of it started the browser sends a request. After receiving the selenium Server Http request sent by the browser, its own restructuring HTTP request to obtain the corresponding web page.

  5. Http Proxy selenium SerVer of the received web page returned to the browser.

  Above selenium1 developers cleverly put javascrip code base is inserted into the test page, really smart.

  Future selenium1 then they should talk about WebDriver (selenium2) implementation principle.

WebDriver it no longer uses Javascript code base injection, but the direct use of the internal interface of the browser to operate the browser, the browser must rely on internal Native Component, to implement the Web driver API calls into the browser's internal interface. selenium1 synthetic event to Javascript page element processing operations, and used Webdriver internal system interface or function. It can be seen, Webdriver to better simulate the real environment.

  Today, on the first principle mentioned here, we can talk about the next chapter, and the advantages and disadvantages selenium1 webDriver, as well as automated testing target. The author of this article Abstract No. VX public Wang brother automated testing welcome attention retrieval, free public number, updating earlier, and is a series of automated tests speak.

Guess you like

Origin www.cnblogs.com/king44/p/11566796.html