Monday 17 December 2012

Selenium Xpath program

import com.thoughtworks.selenium.DefaultSelenium;
public class Xpath {
public static DefaultSelenium selenium=new DefaultSelenium("localhost",1234,"*firefox","http://");
    public static String OpenURL()
    {   
        selenium.start();
        selenium.open("http://www.mail.in.com/");
        selenium.windowMaximize();
        return "Pass";
    }
    public static void text()
    {
        String str=selenium.getText("//html/body/div[1]/div[2]/div/table/tbody/tr[2]/td[3]/form/div/div[1]/p[2]");
        System.out.println(str);
       
    }
    public static void main(String[] args) {
        // TODO Auto-generated method stub
        OpenURL();
        text();
    }

}

No comments:

Post a Comment