After reading the switch-to-iframe documentation, I am still not sure what will driver.getPageSource() return after driver.switchTo().frame(frame element) is called.
By Page source, I refer to the definition in getPageSource(). But I can't find anything that confirm src's attribute is the same as page source. I think during the switching, webdriver will send a request to the src url and use the response to create a page source for the iframe, is it correct?
Is an iframe src's attribute the address for storing its page source? In here, it says
The src attribute specifies the address of the document to embed in an iframe.
(1) Anyway, let's say if we have an iframe like below
<iframe src="/video.mp4">
#document ----> may or may not exist, not sure if #document create by src or not
<html>
</html>
</iframe>
When the driver switch to this iframe,
Is the "/video.mp4"'s content use to create the iframe's page source (I think page source is the #document)? But this is a video file, how is it possible to use a video as page source (html)?
Or the page source is "/video.mp4"'s conetent + #document?
(2) What if the iframe has a html as src, such as
<iframe src="/file.html">
#document ----> may or may not exist, not sure if #document create by src or not
<html>
</html>
</iframe>
Does the page source become whatever is in file.html PLUS the #document in iframe? Or the #document will only be created using the content from file.html after driver is switch?
(3) If the iframe has no src, such as
<iframe></iframe>
Can the iframe still has page source? What will getPageSource() return in this case after driver switch to this iframe?