WebDriver is a clean, fast framework for Automation development of web-apps. WebDriver takes many advantages over selenium because selenium is written in java-script which causes a significant weakness: browsers impose a pretty strictly model , try to upload a file ,form control etc.
webDriver takes a different approach to solve the same problem as selenium. Rather than being running a java-script application within a browser, it uses whichever the mechanism is most appropriate to control the browser. Like for Firefox ,this means that webDriver is implemented as an extension.
Please download the respective jar related to your language from google code selenium project Download
Now follow below steps:-
1:- Extract the download file into a folder name and include the jars file ion your ClassPath
2:- Sample coding in java
webDriver takes a different approach to solve the same problem as selenium. Rather than being running a java-script application within a browser, it uses whichever the mechanism is most appropriate to control the browser. Like for Firefox ,this means that webDriver is implemented as an extension.
The real beauty which I like most is real time environment, which means we are more closely modeling how the user interacts with the browser, and that we can type into "file" input elements. WebDriver can make use of facilities offered by the Operating System.
With the benefit of hindsight, we have developed a cleaner, Object-based API for WebDriver, rather than follow Selenium's dictionary-based approach.Please download the respective jar related to your language from google code selenium project Download
Now follow below steps:-
1:- Extract the download file into a folder name and include the jars file ion your ClassPath
2:- Sample coding in java
import junit.framework.TestCase;import org.junit.Test;import org.openqa.selenium.By;import org.openqa.selenium.WebDriver;import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxDriver;
public class WebDriverTest extends TestCase{
@Testpublic void test_hellotest()throws Exception{
WebDriver driver = new FirefoxDriver();
// And now use this to visit Google
driver.get(http://www.google.com/webhp?complete=1&hl=en);// Find the text input element by its name
WebElement element = driver.findElement(By.name("q"));
// Enter something to search forelement.sendKeys("Niraj Kumar");
// Now submit the form. WebDriver will find the form for us from the elementelement.submit();// Check the title of the page
System.out.println("Page title is: " + driver.getTitle());
driver.close();
}
}