Understanding the WebDriver architecture
The WebDriver architecture does not follow the same approach as Selenium RC (for more details, refer to http://docs.seleniumhq.org/docs/05_selenium_rc.jsp), which was written purely in JavaScript for browser automation. The JavaScript, in Selenium RC, would then emulate user actions. This JavaScript would automate the browser from within the browser. On the other hand, WebDriver tries to control the browser from outside the browser. It uses the accessibility API to drive the browser. The accessibility API is used by a number of applications to access and control applications when they are used by disabled users and is common to web browsers.
WebDriver uses the most appropriate way to access the accessibility API. If we look at Firefox, it uses JavaScript to access the API. If we look at Internet Explorer, it uses C++. This approach means that we can control browsers in the best possible way.
The system is made up of four different layers, as can be...