Hi,
I am newbie in selenium. (Using Webdriver + Java).
I am working with sample for iframe. I want to locate a iframe on web page.
I used Google chrome's inspect element section to find xpath. Also, I have verified xpath from "Xpath Finder" and it shows correct.
This is my xpath: //*[@id="content"]/tbody/tr/td/p[9]/iframe
However, whenever I am using this Xpath in my code:
//String locator = "//*[@id="content"]/tbody/tr/td/p[9]/iframe"
//WebElement frame = driver.findElement(By.xpath(locator));
//driver.switchTo().frame(frame);
I am getting following exception:
Unknown error: Runtime.evaluate threw exception: DOMException: Failed to execute 'evaluate' on 'Document': The string '(/html/body//iframe|/html/frameset/frame)[@name="//*[@id="content"]/tbody/tr/td/p[9]/iframe" or @id="//*[@id="content"]/tbody/tr/td/p[9]/iframe"]' is not a valid XPath expression.
Please suggest. Appreciate your help.
Thanks,
Ashvini