<iframe id="myIFrame" src="thispage.html"
width="100%" height="600"
frameBorder="2">
</iframe>
// Get the iframe
const iFrame = document.getElementById('myIFrame');
// Let's say that you want to access a button with the ID `'myButton'`,
// you can access via the following code:
const buttonInIFrame = iFrame.contentWindow.document.getElementById('myButton');
// If you need to call a function in the iframe, you can call it as follows:
iFrame.contentWindow.yourFunction();
<script>
setInterval(function(){
document.getElementById("iframeId").classList.add('your-class')
},500);
</script>
Now you need to write css code with your class name. Thank you
<!-- local file: if test.html is in the same directory -->
<iframe src="test.html" width="1000" height="1000">
<!-- local file: if test.html is in the parent directory -->
<iframe src="../test.html" width="1000" height="1000">
<!-- online iframe (youtube as an example) -->
<iframe src="https://www.youtube.com/embed/s4BibernJxU" width="1000" height="1000">
<!-- This tag is used for rendering one page in another.
It by default has a border-->
<iframe src="https://example.com/">This will show if the url does not load</iframe>
- Iframe is html inside another html
- We need to switch selenium focus to iframe
either by using INDEX, NAME-ID, or
as a webelement same way as other webelements.
After switching to Iframe we need to switch back to
the main frame to able to continue in the main frame.
Syntax=
-driver.switchTo().defaultContent();
-driver.switchTo().parentFrame();
<iframe srcdoc="<html><body>The content you see here will never be affected by the CSS of its parent container. It supposed to be rendered in black on a white background.</body></html>"></iframe>