python principle of selenium study notes

A, selenium works (Reference document: https: //blog.csdn.net/dawei_yang000000/article/details/87639928)

Automated test code to the browser sends a request to a drive, such chromedriver.exe (download and placed in the same directory can python installation directory), the browser sends the browser parses the drive,

Browser execute commands parsed. As shown below:

Selenium For each script, http request is created and sent to the browser driver, comprising a browser for receiving the http request of HTTP Server driving, after it receives a request to manipulate the corresponding specific browser according to a request the browser perform specific test procedures, then the browser will step execution results back to the HTTP Server, HTTP Server in turn results back to the Selenium script, if it is wrong http code that we will see a corresponding error message in the console .

Using the HTTP protocol reasons :

Because the HTTP protocol is a standard protocol for communication between a browser and a Web server, and almost every programming language provides a rich http libraries, so that you can easily handle client requests between Client and Server request and the server response response, WebDriver structure is a typical C / S structure, WebDriver API corresponding to a client, a server-side browser driver.

That is why the script can handle Java language, the same browser driver, Python scripting language can also handle it?
Because WebDriver is based on JSON Wire Protocol, which is based on HTTP protocol, HTTP request and response data part BODY further specification information, the main transmission section BODY specific data, which are based on the data in the JSON WebDriver the form and transmission, which is JSON Wire protocol.
So between the Client and Server, as long as the transfer to data based on JSON Wire Protocol, it has nothing to do with the specific scripting language, so that the same drive on a browser which can handle Java scripting language, can also handle scripting language Python a.

Guess you like

Origin www.cnblogs.com/ella-li/p/11621734.html