Frameset not displaying - html

I got this exercise I have to make involving framesets. I've created this html:
<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body>
<frameset rows="50%,50%" cols="50%,50%">
<frame src="../../topleft.html" name="topleft">
<frame src="topright.html" name="topright">
<frame src="botleft.html" name="botleft">
<frameset rows="50%,50%">
<frameset cols="50%,50%">
<frame src="brtl.html" name="brtl">
<frame src="brtr.html" name="brtr">
</frameset>
<frame src="botrbot.html" name="botrbot">
</frameset>
</frameset>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<title>topleft.html</title>
</head>
<body>
topleft
</body>
</html>
All the other html's are identical to topleft.html and therefor I've not included them. Nothing is showing in my browser. What am I doing wrong?

if you are using frameset there is no use of body, so just remove the <body> and </body>.
if you want the browser to display something when no frames are supported follow this link.

Frameset tag can't use the body, so just remove tag after try comes to output.

Related

How to load a page from server in <iframe> / <frame> in Chrome?

How to load a page from server in <iframe> / <frame> in Chrome? Do we have set any specific headers to load?
<HTML>
<HEAD>
<META CHARSET="UTF-8">
<TITLE>TEST</TITLE>
</HEAD>
<FRAMESET ROWS="3%, 97%">
<FRAME SRC="HTTPS://WWW.YAHOO.COM" BORDER="0" />
<FRAME SRC="HTTPS://WWW.GOOGLE.COM" BORDER="0" />
</FRAMESET>
</HTML>
This will help you.
<iframe src="https://www.w3schools.com" height="100%" width="100%"></iframe>

Links are not opening properly in the bottom frame

I am working with frames for the first time. Here is
index.html
<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<frameset rows="20%,*">
<frame name="top" src="top.html" name="topmenu" />
<frame name="main" src="content.html" name="content" />
<noframes>
<body>
Your browser does not support frames.
</body>
</noframes>
</frameset>
</html>
top.html
<html>
<head></head>
<body>
<div id="container">
<!-- begin navigation -->
<nav id="navigation">
<ul>
<li>Contact</li>
</ul>
</nav>
<!-- end navigation -->
</div>
</body>
</html>
content.html
<html>
<head></head>
<body>
Some Content
</body>
<html>
contact.html
<html>
<head></head>
<body>
Contact page
</body>
<html>
With this, the output is as under
Now when I click on the Contact link, instead of displaying the content in the content.html, it opens in a new tab as under
What is the mistake I am making. I believe there is some problem from my side in choosing the proper target.
Frames are not supported in HTML5 ^, it is deprecated, and to get it working the <!DOCTYPE> must be set to either HTML Frameset DTD or XHTML Frameset DTD.
If you check the HTML setting in this jsFiddle you'll see that I had set the DOCTYPE to "HTML 4.01 Frameset" in order to make it works, as in this image:
** Also Note that you have used the name attribute twice in each frame tag and there should be only one!
<frame name="top" src="top.html" name="topmenu" />
<frame name="main" src="content.html" name="content" />
^ Sources:
https://developer.mozilla.org/en/docs/Web/HTML/Element/frame
http://www.w3schools.com/tags/tag_frame.asp

frameset not working in IE but works fine Mozilla

Here's the code that works fine in Mozilla but do not works in Internet Explorer. Any idea. Urgency is high.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
<html lang="en" xmlns="http://www.w3.org/1999/xhtml">
<head>
</head>
<FRAMESET rows="15%,81%,4%">
<FRAMESET>
<FRAME src="header.html" frameborder="0" scrolling="no"></FRAME>
</FRAMESET>
<FRAMESET cols="40%,60%">
<FRAME name="login_menu_frame" src="login_box.html" frameborder="0" scrolling="no"></FRAME>
<FRAME name="login_body_frame" src="login_page_body.html" frameborder="0" scrolling="no"></FRAME>
</FRAMESET>
<FRAMESET>
<FRAME name="login_footer_frame" src="footer.html" frameborder="0" scrolling="no"></FRAME>
</FRAMESET>
</FRAMESET>
</html>
Well, I found the answer. The problem lies in the
IE is only recoznising the first . So, whatever is placed after that is not being loaded in the page.
The solution is to put every other frameset in the first [any other frameset] .
The code that worked is:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
<html lang="en" xmlns="http://www.w3.org/1999/xhtml">
<head>
<FRAMESET rows="15%,81%,4%">
<FRAMESET>
<FRAME src="header.html" frameborder="0" scrolling="no"></FRAME>
<FRAMESET cols="40%,60%">
<FRAME name="login_menu_frame" src="login_box.html" frameborder="0" scrolling="no"></FRAME>
<FRAME name="login_body_frame" src="login_page_body.html" frameborder="0" scrolling="no"></FRAME>
</FRAMESET>
<FRAMESET>
<FRAME name="login_footer_frame" src="footer.html" frameborder="0" scrolling="no"></FRAME>
</FRAMESET>
</FRAMESET>
</FRAMESET>
</head>
</html>
What's up with the CAPS, copy-pasted this from actual -96 sources found on a floppy? ;-P
Also, try and apply consistent indentation for the tags. Your main frameset tag is directly followed by another (rouge) frameset tag, which missing closing tag..
Example usage that clearly indicates which elements are contained inside each other for quick mismatch spotting:
<!DOCTYPE html>
<html>
<head>
<title>HTML Frames</title>
</head>
<frameset rows="10%,80%,10%">
<frame name="top" src="/html/top_frame.htm" />
<frame name="main" src="/html/main_frame.htm" />
<frame name="bottom" src="/html/bottom_frame.htm" />
<noframes>
<body>
<h1>Your browser does not support frames.</h1>
</body>
</noframes>
</frameset>
</html>

Link not working with frame tag in html

I need 3 pages merged in one single page with frame tag so I used a frametag with the src attribute but its not working, is frame tag now obsolete or is it just me?
Here's the code
<html>
<style ="text/css"> </style>
<frameset cols="33.3%,33.3%,33.3%">
<frame src="1.html">
<p>hello</p>
<frame>
<p>productivity</p>
</frame>
<frame>
<p> Entertainment</p>
</frameset>
All the frame pages should follow these mandatory rules:
Page containing <frameset> should not include <html> and/or <body> tags.
The <frame> tags must be close using either <frame></frame> or <frame />.
The <frame> tags must have an 'src' attribute and without src attribute, the space allocated for it will be displayed as a blank page.
For your need the following will be the required answer:
Frame.html
<frameset cols="33.3%,33.3%,33.3%">
<frame src="1.html" />
<frame src="2.html" />
<frame src="3.html" />
</frameset>
1.html
<html>
<body>
<p>Hello</p>
</body>
</html>
2.html
<html>
<body>
<p>Productivity</p>
</body>
</html>
3.html
<html>
<body>
<p>Entertainment</p>
</body>
</html>

Locating Element within the Frameset in Html using selenium Webdriver

I have the following html code
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<frameset id="mainFrameset" bordercolor="#000000" border="2" framespacing="2" frameborder="1" rows="55,*" name="mainFrameset">
<frame scrolling="no" noresize="noresize" marginwidth="0" marginheight="0" src="title.jsp" name="titleFrame">
<frameset id="innerFrameset" framespacing="0" border="0" frameborder="0" cols="20.0%,*" name="innerFrameset">
<frame scrolling="auto" target="mainFrame" noresize="noresize" marginwidth="0" marginheight="0" src="dynamicContents.jsp" name="contentFrame">
<frame scrolling="auto" marginwidth="0" marginheight="0" src="Welcome.jsp" name="mainFrame">
<html>
<head>
<title>retailJava Home</title>
<meta content="text/html; charset=iso-8859-1" http-equiv="Content-Type">
</head>
<frameset id="mainFrameset" bordercolor="#000000" border="0" framespacing="0" frameborder="no" rows="*,*">
<frame scrolling="auto" marginwidth="0" marginheight="0" src="WelcomeMain.jsp" name="welcomeMain">
<html>
<head>
<title>Welcome to retail-j</title>
<link type="text/css" href="/rjBackOffice/stylesheets/maintenance.classic.css" rel="stylesheet">
<base target="_self">
</head>
<body text="#000000" leftmargin="0" topmargin="0">
<div id="WelcomeContainer">
<div id="HeaderLogo">
<div id="WelcomeMessages">
<span id="WelcomeMessage">Welcome to retail-j</span>
<span id="LoginInformation">You are currently logged in as BOB</span>
</div>
</div>
</body>
</html>
</frame>
<frame scrolling="auto" marginwidth="0" marginheight="0" src="SystemManagement/InScreenApplicationAlertViewerServlet" name="alertFrame">
<html>
</frame>
</frameset>
<noframes> <body bgcolor="#FFFFFF" text="#000000" topmargin="0" leftmargin="0"> Sorry your browser does not support framesets. </body> </noframes>
</html>
</frame>
</frameset>
<noframes> <body bgcolor="#FFFFFF" text="#000000" topmargin="0" leftmargin="0"> Sorry your browser does not support framesets. </body> </noframes>
</frameset>
</html>
I am trying to locate the the span element with id WelcomeMessage from the above html code. I tried the following to locate
driver.switchTo().frame("welcomeMain");
WebElement element=driver.findElement(By.xpath(".//*[#id='WelcomeMessage']");
Kindly let me know how to switch between framesets/frames [in case of a complex html with convoluted frames as shown above]and locate the elements inside them.
I get the error " unable to locate element welcomeMain......"
Kindly reply to sort this , thanks in advance.
It might be the issue because of your webdriver control may already inside the default frame, and you may need to take the control out of all frame first before taking it to another frame.
Check whether you are able to switch to all the frames available in that page by using below code and this should be working fine.
for (WebElement e :driver.findElements(By.tagName("frame")))
{
driver.switchTo().defaultContent();
driver.switchTo().frame(e);
if(driver.findElement(By.xpath("yourElement")).isDisplayed())
{
driver.findElement(By.xpath("yourElement")).click();
break;
}
else
continue;
}