background preloader

Test

Facebook Twitter

Getting started with Selenium 2. Selenium 2 features new Api and implementations which goes under the name of WebDriver. It's a simpler, faster, object-oriented Api that applies to modern web application testing problems. No more sending hexedecimal numbers into an element for writing text! A crucial innovation is that you do not need to run a Selenium Server to use the WebDriver Java Api locally, for example to run Firefox on a Linux system like I do. The server can be run independently, but just for compatibility with Selenium 1.x, in grids for distributed testing, or to provide support for bindings in other languages.WebDriver runs directly the browser, as Selenium always did; it does not run in a JavaScript cage. The supported bindings currently are Java, C#, Python, and Ruby; PHP and Perl can access WebDriver via 3rd party bindings. The drivers HTMLUnit, which uses Rhino as JS and does not render pages.

Other drivers include Opera, Android, and iPhone, with the last two running on actual devices or emulators. 15. Using Page Objects with Selenium and Web Driver 2.0 | Summa Blog. Page Objects The Page Objects design pattern is outlined in the Selenium wiki, but to summarize, Page Objects are meant to encapsulate the messy internal state of a page. Changes in the presentation code should only require changes only to the Page Objects, not to the actual test code.

Using a Page Object promotes consistency; there may be five different ways to legitimately determine that you are on the login page, but adhering to the one definition in the Page Object will prevent you from having to maintain the other variants. Page Objects should be ignorant of an application’s business logic, they should only be aware of page state and how to interact with it. By clearly delineating the test code from the page objects, you will be able to use the same page objects in a variety of tests cases and achieve code re-use. The Sample Code The application that we will be using is the Spring Security Contact Example that I deployed locally in a Tomcat 6 container. LoginPage.java HomePage.java. Arquillian. Cargo - Home. Sonar. Cuanto - Track Your Tests - Home.