Quantcast
Channel: Active questions tagged frames - Stack Overflow
Viewing all articles
Browse latest Browse all 67

Working with html frame - not able to access the fame tag element that has been opened after clicking submit button in new html page

$
0
0

I am accessing the elements of the frame with ID = mainfrm, opening the page and submitting the value in input text box and after clicking submit button the html element changes of frame tag with new form id and I am not able to access the new elements of form tag of frame tag with id = mainfrm that has been appeared after submitting. Below providing the code and sample HTML

Sub ACCBAL()    Dim IE As New SHDocVw.InternetExplorerMedium    Dim HTMLdoc As MSHTML.HTMLDocument    Dim DocFrame As MSHTML.HTMLFrameElement    IE.Visible = True    IE.Navigate ThisWorkbook.Sheets("data").Range("E7").Value    While IE.Busy Or IE.readyState <> READYSTATE_COMPLETE: DoEvents: Wend    Set HTMLdoc = IE.document    Set DocFrame = HTMLdoc.getElementById("mainfrm")    Set HTMLdoc = DocFrame.contentDocument    strt_val = ThisWorkbook.Sheets("data").Range("E11").Value    strt_val2 = ThisWorkbook.Sheets("data").Range("E12").Value    For rowno = strt_val To strt_val2        HTMLdoc.getElementById("txtAccID").Value = ThisWorkbook.Sheets("data").Range("A" & rowno).Value        HTMLdoc.getElementsByName("btnSubmit")(0).Click        While IE.Busy Or IE.readyState <> READYSTATE_COMPLETE: DoEvents: Wend' This below part gives old frame data               Set HTMLFrames = HTMLdoc.getElementsByTagName("form")        For Each HTMLFrame In HTMLFrames            Debug.Print HTMLFrame.ID        Next HTMLFrame    NextEnd Sub

HTML PAGE 1

<html><head></head><frameset id="f1"><frameset id="f2"><frameset id="f3"><frame id = "top"><frame id = "mainfrm"><html><form id = "transactionfrm"><table><td><input id="txtAccID"></td></table><table><td><input name="btnSubmit"></td></table></html></frame></frameset></html>

HTML PAGE 2

<html><head></head><frameset id="f1"><frameset id="f2"><frameset id="f3"><frame id = "top"><frame id = "mainfrm"><html><form id = "tranenq"> <table class = "cclass"><td><span>1245455</span></td></table><table class = "cclass"><td><input name="back"></td></table></html></frame></frameset></html>

I wanted to fetch the frame html elements that has been dynamically change in frame 3 mainfrm that has not been updated in HTMLdoc dynamically. Please help


Viewing all articles
Browse latest Browse all 67

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>