I'm trying to develop a new feature for our vb.net order entry system. At the moment I provide an assisted paypal login which loops through transactions and copies the transactions. My program then looks at this data and copies it into text boxes. The operator then approves and saves the record.
So my code uses IHTMLFormElement and loops round form
elements and adds values. However I only really use this to log in to paypal. See my code...
Dim theObject As Object = Nothing
theObject = "https://www.paypal.com/cgi-bin/webscr?cmd=_login-run"
WebBrowPayPal.AxWebBrowser1.Navigate2(theObject)
While WebBrowPayPal.AxWebBrowser1.ReadyState <>
tagREADYSTATE.READYSTATE_COMPLETE
Application.DoEvents()
End While
Dim HtmlDoc As IHTMLDocument2 = CType(WebBrowPayPal.AxWebBrowser1.Document,
IHTMLDocument2)
Dim FormCol As IHTMLElementCollection = HtmlDoc.forms
Dim iForms As Integer = FormCol.length
Dim i As Integer
Dim x As Integer
For i = 0 To iForms - 1
Dim oForm As IHTMLFormElement = CType(FormCol.item(CType(i, Object),
CType(i, Object)), IHTMLFormElement)
For x = 0 To oForm.length - 1
If oForm.elements(x).tagname = "INPUT" Then
If oForm.elements(x).name = "login_email" Then
oForm.elements(x).value = "
[email protected]"
End If
If oForm.elements(x).name = "login_password" Then
oForm.elements(x).value = "mypassword"
End If
If oForm.elements(x).type = "submit" Or _
oForm.elements(x).type = "SUBMIT" Then
oForm.elements(x).click()
End If
End If
Next
Next i
I'm now trying this page
https://www.paypal.com/uk/cgi-bin/webscr?cmd=_history&nav=0.3.0
Which is the history page, which allows you to search on the paypal transaction id.
Unfortunately you need to click on 'find a transaction' which then uses some javascript to shows the post fields. So the problem is that the fields I need to use are hidden.
How can I click on this java link in code ?