3

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

Saurabh Gaur
  • 23,507
  • 10
  • 54
  • 73
Carlos Iyu
  • 63
  • 6

2 Answers2

2

You should try below

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

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

Saurabh Gaur
  • 23,507
  • 10
  • 54
  • 73
0

You should try the following change and it should work. Change

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

to

IWebElement detailFrame = driver.FindElement(By.XPath(".//frameset[@id='frmSet']"));
Naman
  • 27,789
  • 26
  • 218
  • 353