Selenium - How does the Selenium WebDriver work?

版权声明:欢迎转载并请注明出处,谢谢~~ https://blog.csdn.net/chimomo/article/details/50903268

Actually, your automation scripts use Selenium commands for emulating user actions on a web page. When the automation script is executed, the following steps happen:

1. The browser driver is created

The browser driver is implemented in a EXE file or a browser extension:

  • CHROME browser
  • INTERNET EXPLORER browser
  • FIREFOX browser

The browser driver uses an HTTP SERVER which waits continuously for new Selenium commands. It has the following purposes:

  • Read HTTP requests coming from the client (client = computer that executes the automation scripts)
  • Determines the series of steps needed for implementing the Selenium command
  • Sends the implementation steps to the browser
  • Gets the execution status from the browser
  • Send the execution status back to the client

2. The HTTP server starts listening for Selenium commands HTTP requests

3. For each Selenium command from the automation script, a HTTP request is created

For each Selenium command of the automation script, a http request with a specific path is created. When the automation script is executed, the first http request generates a new session that is specific to the browser where the automation scripts run. The session id will be used for the http requests that correspond to all other Selenium commands from the automation script.

4. The HTTP request is sent to the HTTP server

5. The HTTP server determines the steps needed for implementing the Selenium command

6. The implementation steps are sent to the browser

7. The implementation steps are executed on the browser

8. As soon as the execution status is returned from the browser, the HTTP server send the execution status back to the client (client = computer that executes the automation scripts)

猜你喜欢

转载自blog.csdn.net/chimomo/article/details/50903268