Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Selenium1 (Selenium RC)

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/03 Report--

Resource recommendations:

Video resources: series of videos related to software testing

Community Resources: automated Test Communication Group

Selenium1 (Selenium RC) Selenium1 component

Selenium Server, responsible for starting and closing browsers, interpreting and running Selenese instructions passed from the test program, and acting as HTTP Proxy.

Client development library, which provides api for writing test scripts for instruction interaction with Selenium Server.

Selenium1 Architecture

In order to better understand how Selenium RC Server works and why proxy injection is used to complete test instruction execution, the first thing you must understand is the "The Same Origin Policy".

The Same Origin Policy, the reason why all browsers in the market apply this policy is to prevent javascript from other sites from accessing web information on this site. "homologous policy" means that browsers only execute code under the currently accessed domain (domain), but not code from other sites. If this method works, a lot of our information can be easily stolen by cross-site methods. That is to say, XSS (Cross-Site Scripting).

Therefore, if Selenium Core (Javascript library) wants to correctly execute Selenese instructions in the target site, it must place it in the same origin as the tested Web application.

Because Selenium Core is implemented by javascript, it cannot avoid the limitation of the same origin policy, but Selenium RC is not subject to this restriction and uses Selenium RC as a proxy to avoid the same origin problem.

For more information about the same origin policy and XSS, please refer to the following articles: Same Origin Policy, XSS

The Selenium1 architecture is shown in the following figure:

When we perform a test, we follow the steps below:

1. The client (test script) establishes a connection with SelenIum-RC.

2. Selenium-RC launches the browser and loads a page with javascript injected with Selenium-Core. At this time, the browser will load a default user configuration and set the browser proxy to localhost:4444. The purpose is to enable all requests from the browser and all responses from the server to be forwarded through this proxy service.

3. The client starts sending instructions to Selenium-RC Server

4. After receiving the instruction, Selenium-RC Server interprets and triggers the injected javascript to execute the instruction.

5. When the browser receives the javascript instruction, it is equivalent to the real user interacting with the UI and sending a Http request to the HTTP Proxy.

6. Selenium-RC Server interacts with web server, obtains the web server response, disguises it as the page loaded in the second step appears to be from the same server, and in turn circumvents the browser homology policy.

7. After receiving the response content, the browser performs operations such as rendering.

Click the link to join the group [Yue sharing testing Alliance]: https://jq.qq.com/?_wv=1027&k=5DiePik

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report