Reputation: 155
i m trying to get the element using selenium by id and by XPATH but in both cases unable to locate error occurs. Code:
IWebDriver dr = new ChromeDriver();
dr.Navigate().GoToUrl("http://epaper.dawn.com/");
IWebElement today = dr.FindElement(By.XPath("//*[@id='planetmap']"));
Code of the element is
I have tried both id and XPATH method
Upvotes: 0
Views: 1470
Reputation: 473813
The desired element is inside an iframe
, switch to it first:
dr.SwitchTo().Frame("DawnPaperFrame");
IWebElement today = dr.FindElement(By.XPath("//*[@id='planetmap']"));
Upvotes: 1