first, Let's look at a classic example: take a taxi
In taxi driving, There are usually 3 characters:
- Passenger: he told the taxi driver where he wanted to go and how to get There.
对出租车司机说:1、去阳光棕榈园东门2、从这里转左3、然后直行 200米,第一个红绿灯右转4、再直行 50米,到阳光棕榈园东门5、停车
- Taxi Driver: He is in accordance with customer requirements; Taxi drivers use the steering wheel and car pedal to drive a car to their destination
出租车司机操作汽车:1、插钥匙点火,启动汽车引擎2、开一小段路后左转3、加速,直行200米4、右转,直行50米5、减速停车,到达阳光棕榈园东门
- Car: car performs taxi driver's operation
1、启动引擎2、左转3、直行4、右转5、停车
In test automation using selenium webdriver, there are 3 roles
- Test engineer who writes automation code: runs the automation code to send the request to the browser driver
告诉浏览器 :1、打开 www.abc.com2、做一个关键字搜索 selenium3、检查实际结果,与预期结果做比较
- Browser Driver: It executes the request of the test engineer and then it sends the request to the browser
告诉浏览器 :1、给我打开这个页面 www.abc.com2、当textbox显示可见,保存这个web element3、操作textbox这个对象,输入selenium4、当确认按钮可以点击,保存这个web element对象5、点击这个按钮对象
- Browser: it performs a browser-driven request
1、打开www.abc.com2、找到搜索框textbox,输入selenium3、点击搜索按钮4、展示搜索结果
Make an analogy:
- Test engineers are like customers
- Browser drivers are like a taxi driver
- The browser is like a car car rental
Executing the automation script, The following steps are Performed:
- For each selenium command, an HTTP request is created and sent to the browser driver
- Browser driver uses HTTP server to get HTTP request
- The HTTP server determines the steps required to implement the selenium command
- Implementation steps are performed on the browser
- The execution state is sent back to the HTTP server
- An automation script that returns this state on the HTTP server
Reference article:
Webdriver automated testing is like taking a taxi.
How does selenium Webdriver work?