Vídeo recomendado
https://youtu.be/diWPPPhW-9E

Acessar Elementos HTML dentro de outros....

Fórum para dúvidas sobre os fundamentos da linguagem de programação Visual Basic no contexto do VBA
hopemissoes
Colaborador
Colaborador
Mensagens: 10
Registrado em: Sex Jul 25, 2014 3:10 pm

Acessar Elementos HTML dentro de outros....

Mensagem por hopemissoes »

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á


Disable adblock

This site is supported by ads and donations.
If you see this text you are blocking our ads.
Please consider a Donation to support the site.


hopemissoes
Colaborador
Colaborador
Mensagens: 10
Registrado em: Sex Jul 25, 2014 3:10 pm

Re: Acessar Elementos HTML dentro de outros....

Mensagem por hopemissoes »

gente pra ser mais especifico o site é:

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

muito obrigado, estou precisando muito disso


magushi
Colaborador
Colaborador
Mensagens: 37
Registrado em: Qua Set 17, 2014 9:42 am

Re: Acessar Elementos HTML dentro de outros....

Mensagem por magushi »

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


Disable adblock

This site is supported by ads and donations.
If you see this text you are blocking our ads.
Please consider a Donation to support the site.


Responder