Tuesday, 8 April 2014

Finding the link inside the span (Using Xpath) using Selenium WebDriver


The selenium driver is not find the link inside the span by using linktext() or partialLinkText(). SO we should use xPath for finding the link

which it was inside span by using below code.


1) WebElement elementt4= driver1.findElement(By.xpath("/html/body/div[5]/div/div[2]/div/div[2]/table/tbody/tr/td[3]/table/tbody[3]/tr[3]/td

[3]/div[2]/a/span[text()='Repot']"));


2) WebElement elementt4= driver1.findElement(By.xpath("/html/body/div[5]/div/div[2]/div/div[2]/table/tbody/tr/td[3]/table/tbody[3]/tr[3]/td

[3]/div[2]/a/span[@lang='REPOT']"));
                 

3) WebElement elementt4= driver1.findElement(By.xpath("/html/body/div[5]/div/div[2]/div/div[2]/table/tbody/tr/td[3]/table/tbody[3]/tr[3]/td

[3]/div[2]/a/span[contains(@lang,'REPOT')]"));

No comments:

Post a Comment