|
-
May 27th, 2008, 05:38 AM
#1
Thread Starter
Frenzied Member
[RESOLVED] [2008] Web Browser (Click Item) (Got code from code bank, need help)
Hey, I've found some code (by Kleinma I think), which clicks a web browser button, I've successfully found the web browser button.. however I need to, click it via code, or move the mouse there and force it to click..
If anyone knows how to do this via code, I'd appreciate it a lot, otherwise, I need to find a way to set the mouse's position, and also make it click.
I also need to figure out how to get the position of the button on the screen (iX in my code is showing as 168, (I have 800*600 form size))
iX value is 168, is off by about 30-40, and iY (which is in my newer code), is off by about 200-300
My Code:
Code:
Private Sub bClick_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles bClick.Click
Dim curWebForm As HtmlElement = Nothing
If wbBrowser.Document.Forms.Count > 0 Then
curWebForm = wbBrowser.Document.Forms.Item(0)
Dim hecCollection As HtmlElementCollection = curWebForm.All
For Each heElement As HtmlElement In hecCollection
If heElement.Id = "cmdClickMe" Then
Dim heParent As HtmlElement = heElement.Parent
Dim iX As Integer = 0
While 0 < 1
iX += heParent.OffsetRectangle.X
heParent = heParent.Parent
If heParent Is Nothing Then
Exit While
End If
End While
rtbBox.AppendText("iX " & iX & ControlChars.NewLine)
End If
Next heElement
'DirectCast(GetCurrentWebForm.item("cmdClickMe", 0), mshtml.HTMLButtonElement).click()
End If
End Sub
If anyone can help, I'd appreciate it.
Cheers
Icyculyr
Last edited by Icyculyr; May 27th, 2008 at 05:44 AM.
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
|