Ver Mensaje Individual
  #1 (permalink)  
Antiguo 11/09/2012, 06:56
oskarrr
 
Fecha de Ingreso: abril-2007
Mensajes: 99
Antigüedad: 17 años
Puntos: 0
Pasar datos a web con webbrowser en tiempo de ejecución

Hola. Quiero rellenar unos campos en tiempo de ejecución en una web, concretamente usuario, password, y darle clic al login. El clic al login y el campo de password me funcionan bien, pero al intentarle meter texto al campo login me da el error 438 de que no admite ese método o propiedad. Yo pienso que es porque el form (de la web) se llama login y el input text de la web también se llama login.

Este es el código html (resumido):

Código:
<form method="post" action="login.phtml" name="login" style="display:inline"><div style="float:left;">
			<div style="float:left;">
				<div style="float:left;line-height:8px;"><div class="icon mi mi_manager" style="float:left;"></div><p style="float:left;margin:0;padding:0;line-height:8px;padding-top:1px;">Usuario:&nbsp;</p><br /></div>
                                <div style="float:left;">
                                <input type="text" name="login" size="10" maxlength="10" class="userlogin" tabindex="1" style="margin-left:5px;margin-top:4px;" />
                                </div>
			</div>
			<div style="float:left;">
				<div style="float:left;line-height:8px;"><div class="icon i_lock" style="float:left; margin-left:5px; margin-right:4px;"></div><p style="float:left;margin:0;padding:0;line-height:10px;padding-top:1px;">Contraseña:&nbsp;</p><br /></div>
                                <div style="float:left;">
                                <input type="password" name="pass" size="10" maxlength="8" style="width:80px;margin-left:5px;margin-top:4px;" tabindex="2" onkeypress="checkEnter(event, 'login')" class="userlogin" />
                                </div>
		        </div><input type="hidden" name="action" value="login" />
Y este es mi código en VB6:

Código:
Private Sub Form_Load()
    WebBrowser1.Navigate "http://miweb.com/login"
End Sub

Private Sub Command1_Click()
    WebBrowser1.Document.All("login").Value = "pepito" 'aquí falla
    WebBrowser1.Document.All("pass").Value = "12345" 'funciona ok
    WebBrowser1.Document.parentWindow.execScript "submitForm('login','Login')", "JavaScript" 'funciona ok
End Sub