Hallo zusammen,
ich möchte Textfelder einer Internetseite automatisch füllen.
Ich habe hier ein Beispiel aus VB6. Ich habe aber keine Idee wie ich das in .Net portieren kann.
Kann mir hier jemand wieter helfen???
[highlight=vbnet]'Benötigte Verweise
'Microsoft HTML Objekt Library
Dim IEApp As Object, frage As String
Dim i As Integer, IEDoc As Object
Set IEApp = CreateObject("InternetExplorer.Application")
IEApp.Visible = False
IEApp.Navigate "https://www.google.com/accounts/Login"
Do: Loop Until IEApp.Busy = False
Do: Loop Until IEApp.Busy = False
Do: Loop Until IEApp.Document.ReadyState = "complete"
frage = InputBox("Wonach wollen Sie suchen?", "Suche bei Google")
IEApp.Visible = True
'Suchfeld auf der Google.com Seite heißt q , siehe Quelltext der Seite
'IEApp.Document.getelementbyid("q").Value = frage
IEApp.Document.getelementbyid("Email").Value = frage
IEApp.Document.getelementbyid("passwd").Value = "Mein PWD"
'Button Google-Suche heißt btnG usw.
'IEApp.document.getelementbyid("btnG").Click
Dim HTMLDoc As HTMLDocument
Dim oHTML_Element As IHTMLElement
Set HTMLDoc = IEApp.Document
For Each oHTML_Element In HTMLDoc.getElementsByTagName("input")
If oHTML_Element.Type = "submit" Then oHTML_Element.Click: Exit For
Next
Set IEDoc = IEApp.Document
Do: Loop Until IEDoc.ReadyState = "complete"
'Schleife über alle Elemente der Seite
For i = 0 To IEDoc.All.Length - 1
Debug.Print i & vbTab & IEDoc.All.Item(i).innertext & vbTab _
& IEDoc.All.Item(i).nodeName
Next i
Set IEApp = Nothing[/highlight]
Ich bin für jeden Tipp dankbar...
ich möchte Textfelder einer Internetseite automatisch füllen.
Ich habe hier ein Beispiel aus VB6. Ich habe aber keine Idee wie ich das in .Net portieren kann.
Kann mir hier jemand wieter helfen???
[highlight=vbnet]'Benötigte Verweise
'Microsoft HTML Objekt Library
Dim IEApp As Object, frage As String
Dim i As Integer, IEDoc As Object
Set IEApp = CreateObject("InternetExplorer.Application")
IEApp.Visible = False
IEApp.Navigate "https://www.google.com/accounts/Login"
Do: Loop Until IEApp.Busy = False
Do: Loop Until IEApp.Busy = False
Do: Loop Until IEApp.Document.ReadyState = "complete"
frage = InputBox("Wonach wollen Sie suchen?", "Suche bei Google")
IEApp.Visible = True
'Suchfeld auf der Google.com Seite heißt q , siehe Quelltext der Seite
'IEApp.Document.getelementbyid("q").Value = frage
IEApp.Document.getelementbyid("Email").Value = frage
IEApp.Document.getelementbyid("passwd").Value = "Mein PWD"
'Button Google-Suche heißt btnG usw.
'IEApp.document.getelementbyid("btnG").Click
Dim HTMLDoc As HTMLDocument
Dim oHTML_Element As IHTMLElement
Set HTMLDoc = IEApp.Document
For Each oHTML_Element In HTMLDoc.getElementsByTagName("input")
If oHTML_Element.Type = "submit" Then oHTML_Element.Click: Exit For
Next
Set IEDoc = IEApp.Document
Do: Loop Until IEDoc.ReadyState = "complete"
'Schleife über alle Elemente der Seite
For i = 0 To IEDoc.All.Length - 1
Debug.Print i & vbTab & IEDoc.All.Item(i).innertext & vbTab _
& IEDoc.All.Item(i).nodeName
Next i
Set IEApp = Nothing[/highlight]
Ich bin für jeden Tipp dankbar...
Comment