この質問はばかげているように聞こえますが、関数 GetElementsByTagname("frame") を使用すると、長さとして 3 しか返されず、期待どおりに 5 が返されないのはなぜですか?
これは、タグ名「フレーム」の出現の5倍を数えたWebページのHTMLですが、VBAで長さを尋ねると3になります...
私の観察:
1) 3 がメイン フレーム (top_navigation、contentframe、dummyframe) の数であることがわかります。
2) getelementbyname を介してメインフレームの 1 つにアクセスしようとすると機能しますが、コンテンツ フレーム ( leftnavigation または postfachcontent) のサブフレームにアクセスしようとすると機能しません (0 アイテムが検出されました)。
これが私のコードです:
Dim Frame As IHTMLElementCollection
Set Frame = IEDoc.getElementsByName("contentframe") ' this works and returns 1 item
MsgBox Frame.Length
Set Frame = IEDoc.getElementsByName("postfachcontent")
MsgBox Frame.Length ' this returns 0 item
Dim Collection As IHTMLElementCollection
Set Collection = IEDoc.getElementsByTagName("frame")
MsgBox Collection.Length ' this returns 3 and I expected 5...