开发者

How does Selenium RC communicate with Browser

How does selenium commands browser ? I know that selenium proxy's requests to urls and on reponse injects selenium core js api into the response. but how does "click" or any other command reach the browser ? In other word开发者_高级运维s how does selenium invoke the selenium core api injected in the browser page ?


Selenium recommends the use of WebDriver to replace the remote control functionality. TMK, the older code injected Javascript into the browser and communicated via that. The WebDriver code uses the native API for each browser.

"Selenium-WebDriver makes direct calls to the browser using each browser’s native support for automation." via http://seleniumhq.org/docs/03_webdriver.html#selenium-2-0-features


Selenium RC runs a request-loop in the browser (in the Selenium window or frame), and the RC server acts as a forwarding agent between the client and the browser. Here's the sequence:

  1. The test script calls Selenium.Click('SUBMIT').
  2. The client issues an HTTP request that tells the server "next time the browser asks, tell it to click on the 'SUBMIT' button".
  3. The browser may already have an HTTP request waiting for a response, but if not, it will soon.
  4. When the browser sends its HTTP request, the server responds with "click the 'SUBMIT' button".
  5. The browser does what it's told and sends another HTTP request to the server, indicating that the command succeeded.
  6. The server responds to the client's existing HTTP request with an "OK" response.
  7. The Click() routine returns to the script.
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜