Oppure

Loading
02/07/09 21:39
andrex91
Salve,
nonostante abbia cercato sia su internet che sul mio libro di vb, non ho trovato molti dettagli sull'uso dell'oggetto web browser.
Io vorrei fare un programma che presi in input username e password, al click del mio command button, si apri una pagina web al quale si viene loggati grazie ai dati presi in input.
Il mio problema non riguarda la navigazione, ma l'invio dei due dati.
Potreste aiutarmi a risolvere questo problema?
Io avevo pensato a interagire con il codice html della pagina in cui bisogna loggarsi.
Prendendo per esempio pierotofy.it, ho provato a cercare nel codice html e ho trovato questa stringa contenente il form:

<form name='frmlogin' action='pierotofy.it/pages/login/…' method='post' onSubmit="biometric_hash.value = get_biometrical_hash(); hash.value = crypt(user.value,pass.value); user.value=''; pass.value='';"><input type="hidden" name="PHPSESSID" value="fc292ed3721316765c2aab8661965dc2" />
Username:<input type='text' name='user' size=10 style='font-size: 11px'>
Password:<input type='password' name='pass' size=10 style='font-size: 11px' onkeydown="add_biometrical_hash(this);" onclick="this.value = ''; javascript:start_biometrical_hash();">
<input type='hidden' name='hash' value=''>
<input type='hidden' name='biometric_hash' value=''>
<input type='submit' class="submit" value='Login' style='font-size: 11px'><br>
oppure <b><a href="pierotofy.it/pages/login/register.php">Registrati</a></b></…;
</form>

E io ero sulla strada di scrivere una riga di codice del tipo webbrowser1.document.body.ecc..
Se qualcuno potrebbe delucidarmi su questa questione mi farebbe davvero un grosso favore.
Grazie ancora
aaa
05/07/09 12:41
GrG
secondo me dovresti usare il metodo get e collegarti all'url tipo:
tuosito.it/… utente&pass=la password
aaa
05/07/09 23:10
andrex91
ciao perdonami per l'ora in cui scrivo,
cmq volevo dirti ke ho provato il metodo ke mi hai suggerito ma nn mi funziona; trovando pero un tuo post ho provato a seguire le istruzioni da te riportate:

pierotofy.it/pages/extras/forum/6/53257-interagire_con_una_pagina_web/

ho provato cosi a mettere il codice:

Private Sub Command1_Click()

WebBrowser1.Document.Forms(1).user.Text = "xxx"
WebBrowser1.Document.Forms(1).pass.Text = "xxx"
WebBrowser1.Document.Forms(1).submit

End Sub

Private Sub Form_Load()
WebBrowser1.Navigate "pierotofy.it/…;
End Sub

Pero mi da un errore: "object doesn't support this property or method"
credo sia xke nn compare la voce "value" nelle righe di user e pass.
Saresti in grado di suggerirmi qualche idea?
grazie
aaa
27/07/09 16:03
hemmaus
Hai risolto ?
Se si come?

Ciao
aaa
27/07/09 18:36
GrG
accidenti, mi era sfuggito questo post... eh vbb comunque la proprietà text non esiste, bisogna usare value...

quindi:
Private Sub Command1_Click()

WebBrowser1.Document.Forms(1).user.value = "xxx"
WebBrowser1.Document.Forms(1).pass.value = "xxx"
WebBrowser1.Document.Forms(1).submit

End Sub 
aaa
28/07/09 13:21
hemmaus
Postato originariamente da GrG:

Private Sub Command1_Click()

WebBrowser1.Document.Forms(1).user.value = "xxx"
WebBrowser1.Document.Forms(1).pass.value = "xxx"
WebBrowser1.Document.Forms(1).submit

End Sub 


Mi permetto di correggere perchè altrimenti non funziona:

Private Sub Command1_Click()

WebBrowser1.Document.Forms(0).user.value = "xxx"
WebBrowser1.Document.Forms(0).pass.value = "xxx"
WebBrowser1.Document.Forms(0).submit

End Sub 


Ciao a tutti e grazie a Grg!
Ultima modifica effettuata da hemmaus 28/07/09 13:25
aaa