Selenium Webdriver-Unable to find any element inside second child iframe(having dynamic name)
![**Child frames are having dynamic name/id**]
I have to find a prompt box inside the second child iframe.
the parent iframe is having fixed id.Able to find element inside that
The first child iframe is having dynamic name/id.
cframe_ms_id59 .Only last part changes.i.e.
I am able to find this element using
But my prompt box having a textbox resides in the **Second Child iframe** **having dynamic name/id.**I am not able to enter inside this iframe** and not able to find any element inside that.
You have two options here
– Try index of frame, it should be 2nd index . SwitchTo().Frame(index). This true if this iframe will remain here only.
– Try finding the element by Xpath and then get the attribute ID of the element and use it to switch
WebElement element = driver.FindElement(By.Xpath(<XPath of the iframe>));
String IFrameId = element.getAttribute(“id”);