Imports System.Threading.Thread Imports System.Text.RegularExpressions Imports SHDocVw Imports mshtml Module Module1 Dim objIE As InternetExplorer = Nothing Dim objIE11 As InternetExplorer = Nothing Dim objIE21 As InternetExplorer = Nothing Sub Main() objIE = CreateObject("InternetExplorer.Application") objIE.Navigate("http://www.google.com.au") objIE.Visible = True While objIE.Busy = True Sleep(1000) End While Dim blnFoundSubmit As Boolean = False Do Dim a For Each a In objIE.Document.GetElementsByTagName("A") If a.innerText = "News" Then blnFoundSubmit = True Exit For End If Next If blnFoundSubmit Then a.Click() ' NOTE: allow pop-ups... Sleep(2000) Else Sleep(200) End If Loop Until blnFoundSubmit objIE11 = CreateObject("InternetExplorer.Application") objIE11.Navigate("http://ninemsn.com.au/") objIE11.Visible = True While objIE11.Busy = True Sleep(1000) End While objIE21 = CreateObject("InternetExplorer.Application") objIE21.Navigate("http://au.yahoo.com/") objIE21.Visible = True While objIE21.Busy = True Sleep(1000) End While Do ScanIEWindows() Threading.Thread.Sleep(2000) ScanIEWindows() Threading.Thread.Sleep(2000) Loop Console.ReadLine() End Sub Public Sub ScanIEWindows() Dim windows As New SHDocVw.ShellWindows() Console.WriteLine(windows.Count) For Each window As SHDocVw.InternetExplorer In windows Console.WriteLine(window.LocationName) Console.WriteLine(window.LocationURL) Next End Sub End Module
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)