Friday, September 9, 2011

New selenium 2.0 ! ( WebDriver + selenium )

Now Selenium has integrated with webdriver and released with named as a Selenium 2.0 which can offering more object oriented testing and not depending on any server setup like selenium RC.

             It's not tying to any particular test framework, it can be used equally well with JUnit, TestNG or from a plain old "main" method also...

             It can acts just as a normal Java library does: it's entirely self-contained, and you don't need to remember to start any additional processes or run any installers before using it…

             Through WebDriver you only need to pick a driver like called as a Chrome, IE, Fire Fox, iOS, android driver and create a test without any dependencies of a server.this functionality can works using dynamic proxies.It has taken a different approach to solve the problems like where selenium struggling with browsers rather than being a JavaScript application running with in the browser, it uses whichever mechanism is to control the browser.

Earlier selenium test setup setting was like as below:

-          By Using Selenium RC and the proxy settings

                        Selenium selenium = new DefaultSelenium( "localhost", 4444, "*firefox", "http://www.google.com");
                        selenium.start();
                        selenium.type("name", "text");

      After integrating with the webdriver replaced that code as below:

                        WebDriver driver = new FirefoxDriver();
                        driver.get("http://www.google.com");
                        WebElement searchBox = driver.findElement(By.name("q"));
                        searchBox.sendKeys("selenium");

            Once your project is set up, you can see that WebDriver acts just as any normal library..that means that you shouldn't expect a WebElement to be a particular subclass, even if you know the type of the driver.. It can step outside the Java Scripting and much more object oriented testing capabilitie...

             One of main future  which I can like “Page object”. Page Objects are objects within the test code it self... it can reduces the amount of duplicated code and means that even if the UI changes, the fix need only be applied in one place ...


No comments:

Post a Comment