Web Page Source

Tyler G.
Lititz, PA

Dec 2, 2010
19 Posts

0  |  0  

Re: Web Page Source

I am trying to post data to a form on a web site and store the resulting page's source code so I can extract data from it. I came across the Navigate method for ALog but I do not want to display the resulting web page. I only want its source code.

DrATEasy (Ron Y.)
Mission Viejo, CA

Dec 2, 2010
358 Posts

0  |  0  

Re: Web Page Source

Try the following:

log1.PlainText=False
log1.Navigate("http://www.marvintest.com")
delay(1000)
DoEvents()
log1.SaveAs("c:\\a.html")
fileremove("c:\\a.txt") ! just in case we run the second time
filerename("c:\\a.html", "c:\\a.txt")
log1.PlainText=True
log1.LocationURL="c:\\a.txt"

Tyler G.
Lititz, PA

Dec 3, 2010
19 Posts

0  |  0  

Re: Web Page Source

Thank you Ron. This is what I needed.

Tyler G.
Lititz, PA

Dec 3, 2010
19 Posts

0  |  0  

Re: Web Page Source

The code to save the page source is great but  I can't seem to get the PostData to work in the navigate function. It will only display the web page and not the result of the post.

DrATEasy (Ron Y.)
Mission Viejo, CA

Dec 6, 2010
358 Posts

0  |  0  

Re: Web Page Source

Seems like what you were asking was a feature requested from Microsoft ( https://connect.microsoft.com/VisualStudio/feedback/details/115580/add-postdata-or-navigate2-to-windows-forms-webbrowser )


Maybe the following article will help you:
http://www.codeproject.com/KB/IP/httpget-post.aspx

Let me know,
Ron

Tyler G.
Lititz, PA

Dec 13, 2010
19 Posts

0  |  0  

Re: Web Page Source

Ron,    
It looks like the ability to post data has been added to WebBrowser.Navigate. My problem was that I was trying to post a string instead of a byte array. Here is the solution that I ended up with and it is now working fine.


log1.Navigate("site_to_post_data_to",,"_self",' target="_self", data_to_post_as_byte_array, "Content-Type: application/x-www-form-urlencoded" + Chr(10) + Chr(13))

Thanks for your help.



Please Note
You need to have a M@GIC account to participate in the Forums.
Not yet registered on our website? Click here to register today!

All content, information and opinions presented on the Marvin Test Solutions User Forums are those of the authors of the posts and messages and not Marvin Test Solutions'. All attachments and files are downloaded at your own risk. [Read More]