Selenium is an automation test framework, it is mainly used to test web applications, it is open source and free. With this tool, test cases can be run directly in web browsers just like a real human operate the web browsers. It supports a lot of web browsers(Chrome, Firefox, IE, Opera, Safari, etc). Selenium also has a lot of different sub-tools to support different automation test approaches.
Users can use a lot of main programming languages (java, python, PHP, Javascript, c#…etc) to write test case scripts in selenium. Then run the script to verify test cases in most main web browsers. Not only those automation test scripts can be run in Windows, Linux, macOS, they can also run on mobile os like android, ios and windows mobile.
This test tool for the functional tests is recognized as the most portable test framework in all open-source test tools, especially for web application automation.
1. Selenium Automation Tool Suite Components Introduction.
1.1 Selenium Automation Tool Suite Components Overview.
- There are four tools in this automation tool suite, each for a special test requirement.
1.2 Selenium Integrated Development Environment( IDE ).
- Selenium Integrated Development Environment( IDE ) components diagram.
- As a Firefox or Google Chrome plugin, selenium IDE can be used to create test script prototypes quickly and easily.
- It can record human tester actions as a script (in any programming language) while the tester runs the test case manually.
- The recorded test script can be executed later for regression test automatically.
- This tool can access the browser’s DOM (Document Object Module) elements using Javascript.
- It also provides a flexible interface for testers to create or update test cases.
1.3 Selenium Remote Control (RC).
- Selenium Remote Control (RC) components diagram.
- Selenium RC is the main feature of selenium. The tester can use it to simulate user actions (such as click button, submit an Html form, input data in text box) in web browsers.
- When the web browser is loaded in the test script, it injects a suite of Javascript into it. Then use these Javascripts to interact with the web browser.
- Typical Usage For Selenium RC:
1) Tester write test case script with supported programming language API.
2) When the test script is running, it opens a web browser and injects selenium core which is just a suite of Javascripts, then uses these Javascripts to execute the command.
3) Test script send command to RC server.
4) RC server receives these command and trigger selenium core to execute the commands and interact with browser page web elements.
1.4 Selenium Webdriver.
- Below is the selenium webdriver components diagram.
- Webdriver is the main new feature added in selenium 2. Webdriver aimed to deliver an easy and helpful programming interface to resolve the limitations of Selenium RC programming API.
- Different from selenium RC, webdriver uses browser native support to interact with web pages. So different browser has different webdriver driver library and different features. All these are decided by the web browser that runs the test cases.
- The implementation of webdriver is highly related to the web browser. So there are the following webdriver drivers.
- HttpUnit Driver: The fastest and lightest webdriver implementation. Based on HttpUnit, it can be run across Windows, Linux, macOS because of its pure java implementation.
- Firefox Driver: Easiest to configure and use. Used to run test scripts in Firefox web browser. Do not need extra configuration to use.
- Chrome Driver: Used to run test script in google chrome web browser, need more configuration to use.
- Internet Explorer Driver: Used to run test script in internet explorer web browser, need more configuration to use. Can only run in windows os, slower than Firefox and Chrome web driver.
1.5 Selenium Grid.
- Below is the selenium grid components diagram.
- With the selenium grid, test scripts can be run on multiple machines at the same time.
- This can reduce the total test scripts run time.
- The selenium grid can also make bug finding more quickly because the test cases run quickly.
- This is suitable for big software with too many test scripts to run.
- We can also choose to test different web browsers on different machines. You can configure browser version, os, and machine to run the test case by using selenium RC’s Capabilities.
I am fresh new to selenium programming. I want to use python to write a selenium automation test script. And the test script should operate web page elements with javascript. My question is how does selenium use javascript to operate the web page? Does selenium translate all the python source code to javascript? Thanks a lot.