"Karmanyevadhikaraste ma phaleshu kadachana, Ma karma phala hetur bhurmatey sangostva akarmani."

web driver2

open a browser and click on links:

FirefoxDriver driver= new FirefoxDriver();
driver.get("http://Gmail.com");
 driver.findElement(By.id("Email")).sendKeys("meerajaanasuri");
 driver.findElement(By.id("Passwd")).sendKeys("kUMAR$98");

 driver.findElementById("signIn").submit();

Xpath:

// means partial xpath
* any element on web page


//tag[@attr='value']
eg:  //*[@id='Email']
 //*[@id='Email' and name ='ddd']
//input[type='submit' and @class='ccgg']

get text:
String p= driver.findElement(By.xpath("html/body/div[1]/div[2]/div[1]/h2")).getText();

suppose there r 10 buttons have same class..
css class,look and feel be d;/f
By.className  or findelement (by.xpath("//input[@class='kkk']))


CSS selectors:
driver.findElement(By.cssSelector("input[id='Email']")).sendKeys("meeraja");

if it is some content which is in  a div class with a p paratag..
"div[class='hjhjhj'] p   //no slash just give some gap in css

if theres is id, simply
or By.cssSelector(" #Passwd")

or use symbols like ^ $ etc..

By.cssSelctor("input[name^='Emai')).sendkeys("startswith")
By.cssSelctor("input[name$='ail')).sendkeys("endswith")
By.cssSelctor("input[name*='mai')).sendkeys("contains")