Acessar Elementos HTML dentro de outros....

hopemissoes

25-07-2014 18:18:55

Gente, já andei pesquisando bastante aqui nesse forúm e até ja percebi que esse problema já foi discutido aqui, porém sem resposta ainda no ano de 2013, queria q vcs me ajudasse...por favor

Em resumo, acessar um elemento dentro de uma tabela. Vou colocar o código pra vcs

<form name="loginForm" method="post" action="/sigaa/logar.do?dispatch=logOn">
<input type="hidden" name="width" value="1366" id="width">
<input type="hidden" name="height" value="768" id="height">
<input type="hidden" name="urlRedirect" value="">
<input type="hidden" name="subsistemaRedirect" value="">
<input type="hidden" name="acao" value="">
<input type="hidden" name="acessibilidade" value="">

<script>
document.getElementById('width').value = screen.width;
document.getElementById('height').value = screen.height;
</script>

<table align="center" width="100%" cellspacing="0" cellpadding="3">
<tbody>
<tr>
<th width="35%"> Usuário: </th>
<td align="left"> <input type="text" name="user.login" size="20" value=""></td>
</tr>
<tr>
<th> Senha: </th>
<td> <input type="password" name="user.senha" size="20" value=""> </td>
</tr>
</tbody>
<tfoot>
<tr>
<td colspan="2" align="center">
<input type="submit" value="Entrar">
</td>
</tr>
</tfoot>
</table>
</form>




Preciso acessar esse elemento "user.login" pra poder fazer login de um site... Por favor, me ajudem, ja estou tentando há vários dias e nada....muito obrigado desde já

hopemissoes

25-07-2014 23:07:21

gente pra ser mais especifico o site é:

https://sistemas.ufpb.br/sigaa/verTelaL ... 9C6DF2735F

muito obrigado, estou precisando muito disso

magushi

19-09-2014 18:14:16

hope, boa tarde!

Segue o Código.

Sub Logar()
Dim Dc_Usuario As String
Dim Dc_Senha As String
Dim Dc_URL As String
Dim objIE As New InternetExplorer 'Referencie "Microsoft Internet Controls"

'Abre o IE
objIE.Visible = True
objIE.Left = 100
objIE.Top = 60
objIE.Width = 1000
objIE.Height = 800

a = 2

front = "https://sistemas.ufpb.br/sigaa/verTelaL ... 9C6DF2735F"
logi = "login" ' coloque o login
sen = "Senha" ' coloque a senha


objIE.Visible = True




objIE.Navigate front

With objIE

Do While objIE.Busy
Application.Wait DateAdd("s", 2, Now)
Loop



.Document.getElementById("user.login").Focus
.Document.getElementById("user.login").Value = logi
.Document.getElementById("user.senha").Focus
.Document.getElementById("user.senha").Value = sen
.Document.All("submit").Click
Do While objIE.Busy
Application.Wait DateAdd("s", 2, Now)
Loop

objIE.Navigate pag



Debug.Print .LocationURL
End With
End Sub

Espero ter ajudado!

Magushi