Selenium Concepts: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
Line 16: Line 16:
==WebDriver APIs==
==WebDriver APIs==
<font color=darkgray>WebDriver does not require its API to be compiled with the web application code, so it is not intrusive and allows testing the same application that is available in production.</font>
<font color=darkgray>WebDriver does not require its API to be compiled with the web application code, so it is not intrusive and allows testing the same application that is available in production.</font>
=Selenium IDE=
The Selenium IDE is a tool that can be used to develop Selenium test cases. It is offered as Chrome and Firefox extensions. It records the user's actions in the browser and translates them into Selenium commands, producing Selenium scripts.


=TO REFACTOR=
=TO REFACTOR=

Revision as of 18:46, 28 May 2021

Internal

Overview

Selenium is a set of tools that can be used to automate testing of UI web applications running in browsers. Modern web browsers expose browser automation APIs that can be used to control the browser and run tests. Selenium operates on those APIs via its WebDriver component.

Web Browser

Browser Automation APIs

Modern browsers expose browser automation APIs that allow programmatically operating the browser as if a real user would do it. The availability of such API facilitate writing automated tests that simulate very closely a user interaction with the browser and with the application rendered by the browser. The Selenium component that interacts with the browser's automation API is WebDriver.

WebDriver

WebDriver APIs

WebDriver does not require its API to be compiled with the web application code, so it is not intrusive and allows testing the same application that is available in production.

Selenium IDE

The Selenium IDE is a tool that can be used to develop Selenium test cases. It is offered as Chrome and Firefox extensions. It records the user's actions in the browser and translates them into Selenium commands, producing Selenium scripts.

TO REFACTOR

Selenium Architecture

Selenium has a client-server architecture, and includes both client and server components. Selenium Testing from Java.png

Client

The Selenium client exposes the WebDriver API, which can be used to interact with the page. The client extends RemoteWebDriver, which communicates with the remote Selenium server. There are browser-specific constructors for the WebDriver (ChromeDriver, FirefoxDriver). There is still confusion on whether the client loads and uses a local driver or connects remotely to a server.

Server

The Selenium server receives request from the Selenium client's RemoteWebDriver. It also includes WebDriver API to run tests against web browsers on the server machine.

Navigation to a Web Page

WebDriver driver = new ChromeDriver();
driver.get("http://example.com");