Hi,
I´m trying to access a table in a webpage. I´ve managed to log in with username and password and several navigation steps, mainly using Document.getElementById and .click for buttons and parentWindow.execScript when the button was associated with a script. I got to a point where I´m definitely struck . I got to a page where none of the getElement works to find the reference to the button I want and besides that the button works in different way : there is an onmouseover tag associated with a script of some kind.
I tried to use getElement to an inner frame where the tag should be found with no success.
Here´s the code I have so far :
Sub GetTable()
Dim I As Long
Dim ieApp As InternetExplorer
Dim ieDoc As Object
Dim ieTable As Object
Dim clip As DataObject
Dim objElement As Object
Dim objCollection As Object
'create a new instance of ie
Set ieApp = New InternetExplorer
ieApp.Visible = True
ieApp.Navigate "xxxx"
Do While ieApp.Busy: DoEvents: Loop
Do Until ieApp.ReadyState = READYSTATE_COMPLETE: DoEvents: Loop
Set ieDoc = ieApp.Document
With ieDoc.forms(0)
.Document.login_financ.Email.Value = "xxxx"
.Document.login_financ.Senha.Value = "xxxx"
End With
Application.StatusBar = "Search form submission. Please wait..."
ieApp.Document.getElementById("b").Style.display = "none"
ieApp.Document.getElementById("c").Style.display = "none"
Set objCollection = ieApp.Document.getElementsBytagname("input")
I = 0
While I < objCollection.Length
If objCollection(I).Name = "email" Then
' Set text for search
objCollection(I).Value = "xxxxx"
Else
If objCollection(I).Name = "Senha" Then
objCollection(I).Value = "xxxxx"
End If
If objCollection(I).Type = "button" And objCollection(I).Name <> "Normal" And _
objCollection(I).Value = "Entrar" Then
' "Search" button is found
Set objElement = objCollection(I)
I = objCollection.Length
End If
End If
I = I + 1
Wend
ieApp.Visible = True
objElement.Click ' click button to search
Do While ieApp.Busy: DoEvents: Loop
Do Until ieApp.ReadyState = READYSTATE_COMPLETE: DoEvents: Loop
Set objCollection = ieApp.Document.getElementById("financ")
objCollection.Click
Do While ieApp.Busy: DoEvents: Loop
Do Until ieApp.ReadyState = READYSTATE_COMPLETE: DoEvents: Loop
Set objCollection = ieApp.Document.getElementById("button2")
objCollection.Click
Do While ieApp.Busy: DoEvents: Loop
Do Until ieApp.ReadyState = READYSTATE_COMPLETE: DoEvents: Loop
Set objCollection = ieApp.Document.getElementById("continua")
objCollection.Click
Do While ieApp.Busy: DoEvents: Loop
Do Until ieApp.ReadyState = READYSTATE_COMPLETE: DoEvents: Loop
Set objCollection = ieApp.Document.getElementById("continua")
objCollection.Click
Do While ieApp.Busy: DoEvents: Loop
Do Until ieApp.ReadyState = READYSTATE_COMPLETE: DoEvents: Loop
Call ieApp.Document.parentWindow.execScript("window.open('documentos_menu_financ.asp','main');")
Do While ieApp.Busy: DoEvents: Loop
Do Until ieApp.ReadyState = READYSTATE_COMPLETE: DoEvents: Loop
Set iFrame = ieApp.Document.getElementsByname("main")
Display More
And here is some of the HTML code related to the page I´m stuck :
The “button” I want to activate is inside this frame “main” :
<frame name="main" src="painel_controle.asp" marginwidth="0" marginheight="0" target="main">
<title>Menu Documentos</title>
<link href="estilo/estilo.css" rel="stylesheet" type="text/css">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<base target="main">
<script language="Javascript">
And this is the “button” :
<a href="aviso/documentos_menu_aviso.asp"><img width="155" height="23" id="IMG2" onmouseover="muda(this,'images/aviso_credito_on.gif')" onmouseout="muda(this,'images/aviso_credito_off.gif')" src="images/aviso_credito_off.gif" border="0"></a>
<img width="155" height="23" id="IMG2" onmouseover="muda(this,'images/aviso_credito_on.gif')" onmouseout="muda(this,'images/aviso_credito_off.gif')" src="images/aviso_credito_off.gif" border="0">
Any help would be greatly appreciated.
Thanks