Selenium – Xpath element not found

selenium

I found the following xpath using Firepath and firebug

//div[@class='itudeBox floatDiv']/div[1]/div/text()[2]

this returns the correct value in Selenium.

But when I try the same in Eclipse -> TestNG

selenium.getAttribute("xpath=//div[@class='itudeBox floatDiv']/div[1]/div/text()[2]");

It shows an error "Element not found".

Can someone please shed some light on this?

Thanks.

Best Solution

Try out below one to locate element, let me know about result

//div[text()='AD- Advice']
css=div:contains(“AD- Advice”)
//div[contains(text(),'AD- Advice')] 
Related Question