I use selenium on this site, but I cant use any of its elements. Because they comes from 'frame' and its in 'frameset', here is html part;
<frameset rows="0%, 95%" frameborder="0" frameSpacing="0" marginHeight="0" marginWidth="0">
<frame id='unloadFrame' src="/somesrc" noresize>
<frame src="/somesrc" noresize>
</frameset>
<noframes>
Your browser doesn't support frames, This web site requires a frames capable browser.
</noframes>
I need to access second frame which starts with src, I used this method but still cant use any element;
driver.SwitchTo().Frame(1);
Boolean sa = driver.FindElements(By.Id("ctl00_MainContent_txtCustomerId")).Count > 0;
if (sa == true)
{
driver.FindElement(By.Id("ctl00_MainContent_txtCustomerId")).SendKeys("HelloWorld");
}
Is it because Frame(1) is not frame i want ? Or should i use different way to get into it?
Thank You
This code will also switch to the frame with 'src' attribute as '/somesrc' and with 'id' attribute not 'unloadFrame'
driver.SwitchTo().Frame(driver.FindElement(By.Xpath("//frame[@src='/somesrc' and not(@id='unloadFrame')]")));
Switch IFrame in C# -
eg-
driver.SwitchTo().Frame(0);
driver.SwitchTo().DefaultContent();
IWebElement element= driver.FindElement(By.Id("ElementID"));
driver.SwitchTo().ParentFrame();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With