I have a web control in my application. I use it to login gmail. The web control shows the emails I have. How can I get the HTML source of the page the web control is showing?
thanks
Printable View
I have a web control in my application. I use it to login gmail. The web control shows the emails I have. How can I get the HTML source of the page the web control is showing?
thanks
Here is one way, using DOM:
http://www.vbforums.com/attachment.p...chmentid=36095
thanks. however, it does not work.Quote:
Originally Posted by dglienna
I use:
VB Code:
Dim MyDoc As mshtml.IHTMLDocument2 Set MyDoc = wb.Document dim strTmp as string strTmp = MyDoc.body.innerHTML
to get the HTML, however, it only returns some simple notification text although I can see the page in the web control.
do not know why.
thanks again
Funny but when i look at the source of gmail's page i can see this:
VB Code:
function el(id) { if (document.getElementById) { return document.getElementById(id); } else if (window[id]) { return window[id]; } return null;
which looks like the java even uses DOM, cause this is DOM
then, what I should do? thanks.Quote:
Originally Posted by dglienna
Post the page that you are having trouble with, and let theVader look at it.
I'm sure he'll be along. Also post any code that you are using, or having trouble with.
The webpage is gmail.com. I use below code to login. In the web control, it shows that I login successfully. And I can see these emails. If I use right-click->'view source', I can see the source which includes the information of these emails. However, How can I get this source in VB6 program? when I use MyDoc.body.innerHTML, gets nothing except a short notification.Quote:
Originally Posted by dglienna
thanks
VB Code:
Private Sub wb_DocumentComplete(ByVal pDisp As Object, URL As Variant) Dim MyDoc As mshtml.IHTMLDocument2 Set MyDoc = wb.Document If Not MyDoc Is Nothing Then MyDoc.All.Item("Email").Value = strUserName MyDoc.All.Item("Passwd").Value = strPassword MyDoc.Forms.Item("gaia_loginform").submit End If Set MyDoc = nothing end sub
I've PM'd him for you.
thanks you very muchQuote:
Originally Posted by dglienna
I appreciate your help
If you want to get an email list out of Gmail, you need to be using the "basic HTML" view, instead of the standard view which is JavaScript and therefore doesn't show the page content in the source code.
thanks. it seems i have to load the 'standard view' first, then use basic html. So that, can get the HTML contents. Is there any other better approach?Quote:
Originally Posted by penagate
thanks again
If you have a webbrowser control on your form and you just want to see the source then do this:
If you want to automate the Webpage then do this:Code:Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
Dim DocText As String
Me.WebBrowser1.Navigate("http://www.google.com")
DocText = Me.WebBrowser1.DocumentText
End Sub
'You Have To Go Online To The Page You Want To Automate And Look At The Source In This Case Im Going To Yahoo! And Im Looking For The Search Input Box And Submit Button...
'Yahoo Source Code:
'<input id="p_30345635-p" name="p" type="text" title="Search" value="Search" autocomplete="off" class="input-query y-ln-3 y-txt-input">
'And
'<button style="" class="searchsubmit med-large y-fp-pg-grad" value="Web Search" type="submit" id="search-submit">Web Search</button>
Thank You,Code:
Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
Dim EleSearchBox As Windows.Forms.HtmlElement
Dim EleSearchButton As Windows.Forms.HtmlElement
WebBrowser1.Navigate("http://www.yahoo.com")
'We Have To Wait For The WebBrowser To Load...
Do
My.Application.DoEvents()
Loop Until FormAPABuddy.WebBrowser1.ReadyState = WebBrowserReadyState.Complete
EleSearchBox = WebBrowser1.Document.GetElementById("p_30345635-p")
EleSearchButton = WebBrowser1.Document.GetElementById("search-submit")
EleSearchButton.InvokeMember("onclick")
End Sub
SGT Larry G. Ransom III
Thanks for posting but the question you answered was 6 years old.