Tuesday, October 15, 2013

Java : Double Quotes in Xpath



Double Quotes in Xpath



Use : asc -> char

String Data=((char)34)+"http://www.blogger.com/profile/14790377041798535628"+((char)34);


public class Sample1{   
    public static void main(String[] args)
    {
            WebDriver driver = new FirefoxDriver();
            driver.get("http://seleniumatmindfire.blogspot.in/2012/06/verify-tool-tip-text-in-selenium.html");
            String Data=((char)34)+"http://www.blogger.com/profile/14790377041798535628"+((char)34);
          WebElement toolTipObject = driver.findElement(By.xpath("//a[contains(@href,"+Data+")]"));
            String GoogleTooltip = toolTipObject.getAttribute("title");           
            System.out.print(GoogleTooltip);
    }
}

No comments:

Post a Comment