Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

C#: Selenium - Element is not a frame element : FRAMESET

Tags:

c#

selenium

Im trying to acess and populate some EDIT with selenium, but i got error...

I need to enter in frameset.

HTML :

<iframe src="NIB_MainFrame.asp" name="Principal" style="height:100%;width:100%;border:0;padding:0;border:0;margin:0;display:block;overflow-y:hidden" __idm_frm__="467"></iframe>
<frameset id="frmSet" rows="55,0,*,24" border="0" framespacing="0" frameborder="no">
    <frame noresize="noresize" scrolling="no" name="Header" src="NIB_Header.asp" __idm_frm__="472">
    <frame noresize="noresize" scrolling="no" name="Menu" src="Blank.htm" __idm_frm__="473">
    <frame noresize="noresize" scrolling="auto" name="Corpo" src="NIB_Pre_Bridge.asp?txtAgencia=4346&amp;txtConta=014543708" __idm_frm__="474">
    <frame noresize="noresize" scrolling="no" name="Rodape" src="NIB_Rodape.asp" __idm_frm__="475">
</frameset>
</iframe>

C#

driver.SwitchTo().Frame(0);
IWebElement detailFrame = driver.FindElement(By.XPath("//*[@id='frmSet']"));
driver.SwitchTo().Frame(detailFrame);

ERROR :

OpenQA.Selenium.NoSuchFrameException was unhandled HResult=-2146233088 Message=Element is not a frame element: FRAMESET Source=WebDriver

like image 568
Carlos Iyu Avatar asked Dec 06 '25 21:12

Carlos Iyu


1 Answers

You should try below

driver.SwitchTo().Frame("Principal");
driver.SwitchTo().Frame("Header");

No need to switch frameSet. you can directally switch to Header frame

like image 114
Saurabh Gaur Avatar answered Dec 09 '25 15:12

Saurabh Gaur



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!