Hello guys, first i'm in need of a code that logs in into an website to collect it's information.
I've been trying it in a hole different ways, but none seems to work, i've tryed many codes and kinds, i've seen some problems that i'd not been able to solve.
First of all:
The website never gets ready (readystate 4 never occurs)
Second problem:
if i put a loop waiting for busy ends or readystate 4, it throws me out of the execution.
Third problem:
I got some problems refeering the cells that i need to fill in HTML document.
well, here goes the HTML code:
i need to fill this forms:
i'm using this code at moment, it loads the website, and then stops, i couldn't get further on any other VBA code.
the problem 1 is:
"automation error"
"not specifyed error" (translating myself, my Excell is on brazilian portuguese)
the problem 2 is:
"automation error"
"not specifyed error" (translating myself, my Excell is on brazilian portuguese)
I've been trying it in a hole different ways, but none seems to work, i've tryed many codes and kinds, i've seen some problems that i'd not been able to solve.
First of all:
The website never gets ready (readystate 4 never occurs)
Second problem:
if i put a loop waiting for busy ends or readystate 4, it throws me out of the execution.
Third problem:
I got some problems refeering the cells that i need to fill in HTML document.
well, here goes the HTML code:
HTML:
<body ******="form2.elements[0].focus()" >
<div id="box_login">
<div class="td1Titulo">Identificação</div>
<div class="td1fundoclaro">
<div id="mensagem_erro"></div><br />
<form name="form2" id="form_login" method="post" action="testa_login.asp">
<div class="login_info"> Preencha os campos para acessar a área restrita </div><br />
<div class="login_info left">
<div class="label_50"><label for="txtUsuario">Login: </label></div>
<input type="text" name="txtUsuario" size="10" class="botao required"> </div>
<div class="login_info left">
<div class="label_50"><label for="password">Senha: </label></div>
<input type="password" name="txtSenha" size="10" class="botao required"> </div>
<div class="login_info">
<input type="submit" name="Entrar" value=" Entrar " class="botao">
<input type="reset" name="Limpar" value="Limpar" class="botao">
</div>
<div class="login_info"> <br /> Não sabe ou esqueceu sua senha? <br />
<a href="http://intranet.ad.finep.gov.br/gerenciador/Senha/senha.asp">Clique aqui</a> para gerar uma nova e recebê-la por correio eletrônico. <br /><br /> Para alterar sua senha da intranet:
<a href="http://intranet.ad.finep.gov.br/gerenciador/Senha/troca_senha.asp">Alterar senha</a><br /><br />
<a href="javascript:history.back()" class="rodape">Voltar</a>
</div>
</form>
</div>
</div>
</body>
i need to fill this forms:
HTML:
then click this button:
[HTML]<input type="submit" name="Entrar" value=" Entrar " class="botao">
i'm using this code at moment, it loads the website, and then stops, i couldn't get further on any other VBA code.
Code:
Sub getValues()Dim objIe As Object, xobj As HTMLDivElement
Set objIe = CreateObject("InternetExplorer.Application")
objIe.Visible = True
objIe.Navigate "http://intranet." 'website
' While (objIe.Busy Or objIe.ReadyState <> 4): DoEvents: Wend ' if i cut of this comment and executs the code until here, it gets me the problem 1
Set xobj = objIe.Document.getElementById("box_login")
' executing the code without checking for its readystate, returns me error on the line above (problem 2)
'Set xobj = xobj.getElementsByClassName("login_info").Item(0)
'Set xobj = xobj.getElementsByClassName("data")(0)
Debug.Print xobj.innerText
Set xobj = Nothing
objIe.Quit
Set objIe = Nothing
End Sub
the problem 1 is:
"automation error"
"not specifyed error" (translating myself, my Excell is on brazilian portuguese)
the problem 2 is:
"automation error"
"not specifyed error" (translating myself, my Excell is on brazilian portuguese)