|
-
May 1st, 2005, 08:54 PM
#1
Thread Starter
Hyperactive Member
how to get HTML source from web control?
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
-
May 1st, 2005, 09:06 PM
#2
Re: how to get HTML source from web control?
-
May 1st, 2005, 09:18 PM
#3
Thread Starter
Hyperactive Member
Re: how to get HTML source from web control?
 Originally Posted by dglienna
thanks. however, it does not work.
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
-
May 1st, 2005, 09:26 PM
#4
Re: how to get HTML source from web control?
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
-
May 1st, 2005, 09:41 PM
#5
Thread Starter
Hyperactive Member
Re: how to get HTML source from web control?
 Originally Posted by dglienna
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.
-
May 1st, 2005, 10:21 PM
#6
Re: how to get HTML source from web control?
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.
-
May 1st, 2005, 10:49 PM
#7
Thread Starter
Hyperactive Member
Re: how to get HTML source from web control?
 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.
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
-
May 1st, 2005, 11:01 PM
#8
Re: how to get HTML source from web control?
-
May 1st, 2005, 11:35 PM
#9
Thread Starter
Hyperactive Member
Re: how to get HTML source from web control?
 Originally Posted by dglienna
I've PM'd him for you.
thanks you very much
I appreciate your help
-
May 2nd, 2005, 06:44 AM
#10
Re: how to get HTML source from web control?
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.
-
May 2nd, 2005, 01:37 PM
#11
Thread Starter
Hyperactive Member
Re: how to get HTML source from web control?
 Originally Posted by penagate
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?
thanks again
-
Jun 27th, 2011, 01:59 PM
#12
New Member
Re: how to get HTML source from web control?
If you have a webbrowser control on your form and you just want to see the source 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
If you want to automate the Webpage then do this:
'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>
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
Thank You,
SGT Larry G. Ransom III
-
Jun 28th, 2011, 12:14 PM
#13
Re: how to get HTML source from web control?
Thanks for posting but the question you answered was 6 years old.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|