Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Read HTML from a website using Webrowser or another method

Posted on 2010-11-23
3
Medium Priority
?
358 Views
Last Modified: 2012-06-27
Hi I have a website that divided into 4 frames. I'm trying to create an application that will constantly run on my PC as a task looking for certain text in the HTML in a frame.

When it finds the text it would alert the user by presenting a pop-up message. This is basically a monitoring website that checking network nodes. Instead of staring at the screen looking for critical messages I would like to be notified when there is an alert.

What would be the best way to set this up?

Thanks
0
Comment
Question by:Richard Kreidl
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 32

Accepted Solution

by:
Erick37 earned 2000 total points
ID: 34202283
You can navigate the html by loading the page into an HTMLDocument, then get the specific element you are looking for.

The following requires a reference to microsoft.mshtml



Imports mshtml

...

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

		Dim oDoc As New HTMLDocument
		Dim doc As New HTMLDocument
		Dim mElement As mshtml.IHTMLElement
		Dim mECol As mshtml.IHTMLElementCollection

		''must to put some HTML in the DOM before using it
		Dim iDoc2a As IHTMLDocument2 = DirectCast(oDoc, IHTMLDocument2)
		Dim iDoc4 As IHTMLDocument4 = DirectCast(oDoc, IHTMLDocument4)

		iDoc2a.write("<html></html>")
		iDoc2a.close()


		doc = DirectCast(oDoc.createDocumentFromUrl("http://www.google.com", ""), HTMLDocument)

		While doc.readyState <> "complete"
			''Application.DoEvents()
			System.Threading.Thread.Sleep(10)
		End While

		mECol = doc.getElementsByTagName("td")

		For i As Integer = 0 To mECol.length - 1
			mElement = DirectCast(mECol.item(i), IHTMLElement)
			Debug.WriteLine(mElement.tagName & " : " & mElement.innerText)
		Next

	End Sub

Open in new window

0
 
LVL 21

Expert Comment

by:Alpesh Patel
ID: 34205191
Hi,

If you are browsing from internet then best way to create webrequest for the same url and get the pure HTML in response.

In next compare it with your value if match pop up to user.
0
 
LVL 2

Author Comment

by:Richard Kreidl
ID: 34205302
PatelAlpesh, could you show me the code for this?
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction When many people think of the WebBrowser (http://msdn.microsoft.com/en-us/library/2te2y1x6%28v=VS.85%29.aspx) control, they immediately think of a control which allows the viewing and navigation of web pages. While this is true, it's a…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…

636 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question