I am trying to navigate on a web browser that has multiple iframes that are all tagged with the id of "InlineDialog_Iframe". When I try to switch to the window I get a stale reference exception, which makes sense because the element that was used before was removed from the page. The HTML gives only a src as an alternate element reference but using this line of code doesn't effectively switch the frame.
IWebElement popUpQuery = driver.FindElement(By.XPath("//iframe[contains(@id, 'InlineDialog_Iframe')and contains (@src, '/AdvancedFind/QueryProperties.aspx?dType=1&feature=dashboard')]")); driver.SwitchTo().Frame(popUpQuery);
What can I do to recognize this iframe element? and what is the best practice for a naming these?